{
  "openapi": "3.1.1",
  "info": {
    "description": "# Overview\n\nThe AgentKit API gives your AI agents authenticated access to third-party apps — sending emails, reading calendars, creating tickets, querying databases, and more. Your agent calls a tool; Scalekit handles the OAuth flow, token storage, and API call.\n\n**Base URLs:**\n\n```\nhttps://{your-subdomain}.scalekit.dev (Development)\nhttps://{your-subdomain}.scalekit.com (Production)\n```\n\n## Quickstart\n\n### 1. Get an access token\n\nUse your API credentials from the [Scalekit Dashboard](https://app.scalekit.com) → **Developers → Settings → API Credentials**.\n\n```sh\ncurl -X POST https://<SCALEKIT_ENVIRONMENT_URL>/oauth/token \\\n  -H 'Content-Type: application/x-www-form-urlencoded' \\\n  -d 'client_id={client_id}' \\\n  -d 'client_secret={client_secret}' \\\n  -d 'grant_type=client_credentials'\n```\n\n### 2. List connected accounts\n\n```sh\ncurl https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/connected_accounts \\\n  -H 'Authorization: Bearer {access_token}'\n```\n\n### 3. Execute a tool on behalf of a user\n\n```sh\ncurl -X POST https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/execute_tool \\\n  -H 'Authorization: Bearer {access_token}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"connected_account_id\": \"{connected_account_id}\",\n    \"tool_name\": \"gmail_fetch_mails\",\n    \"params\": { \"max_results\": 5 }\n  }'\n```\n\n## SDKs\n\n```sh\nnpm install @scalekit-sdk/node    # Node.js\npip install scalekit-sdk-python    # Python\n```\n\nFor the full product guide, see the [AgentKit documentation](https://docs.scalekit.com/agentkit/quickstart/).\n\n---\n\nLooking for SSO, SCIM, directory sync, or user management APIs? See the [SaaSKit API reference](https://docs.scalekit.com/saaskit/apis/). For the complete endpoint list across both products, see [All APIs](https://docs.scalekit.com/apis/).\n",
    "title": "AgentKit APIs",
    "contact": {
      "name": "Scalekit Inc",
      "url": "https://scalekit.com",
      "email": "support@scalekit.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0"
    },
    "version": "1.0.0",
    "x-scalar-sdk-installation": [
      {
        "lang": "shell",
        "description": "Set up OAuth 2.0 Client Credentials authentication to access Scalekit APIs. Includes credential configuration, token exchange, and authenticated API request examples.",
        "source": "\n# 1. Obtain API Credentials\n# Get your credentials from the Scalekit dashboard\nexport SCALEKIT_ENVIRONMENT_URL=\"https://your-org.scalekit.dev\" # Your Scalekit environment URL\nexport SCALEKIT_CLIENT_ID=\"your_client_id\"                      # Your client ID\nexport SCALEKIT_CLIENT_SECRET=\"your_client_secret\"              # Your client secret\n\n# 2. Exchange client credentials an OAuth 2.0 access token\nTOKEN_RESPONSE=$(curl -s -X POST \"${SCALEKIT_ENVIRONMENT_URL}/oauth/token\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d \"client_id=${SCALEKIT_CLIENT_ID}\" \\\n  -d \"client_secret=${SCALEKIT_CLIENT_SECRET}\" \\\n  -d \"grant_type=client_credentials\")\n\n# 3. Make Authenticated API Requests\ncurl -X GET \"${SCALEKIT_ENVIRONMENT_URL}/api/v1/organizations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  -H \"Accept: application/json\"\n"
      }
    ]
  },
  "servers": [
    {
      "url": "https://$SCALEKIT_ENVIRONMENT_URL"
    }
  ],
  "security": [
    {
      "oauth2": []
    }
  ],
  "tags": [
    {
      "name": "App Connections",
      "description": "Create and manage connections. A connection holds your environment's settings for one connector, such as Gmail."
    },
    {
      "name": "Connected Accounts",
      "description": "Manage connected accounts for third-party integrations and OAuth connections. Connected accounts represent authenticated access to external services like Google, Notion, Slack, and other applications."
    },
    {
      "name": "Connectors",
      "description": "Manage built-in and custom connectors (providers) that agents can use to authenticate against third-party services."
    },
    {
      "name": "Tool Calling",
      "description": "Execute tools on behalf of users via their connected accounts. Supports both named/pre-defined tools and custom API proxy calls."
    },
    {
      "name": "MCP Configurations",
      "description": "Create and manage reusable MCP configurations."
    },
    {
      "name": "Triggers",
      "description": "Subscribe connected accounts to app events, set up the webhook URL an app sends events to, and inspect, resend or recover the deliveries to your endpoint."
    }
  ],
  "externalDocs": {
    "description": "AgentKit Docs",
    "url": "https://docs.scalekit.com/agentkit/quickstart/"
  },
  "paths": {
    "/api/v1/connected_accounts": {
      "get": {
        "description": "Retrieves a paginated list of connected accounts for third-party integrations. Filter by organization, user, connector type, provider, or identifier. Returns OAuth tokens, API keys, and connection status for each account. Use pagination tokens to navigate through large result sets.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "List connected accounts",
        "operationId": "ConnectedAccountService_ListConnectedAccounts",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by organization ID. Returns only connected accounts associated with this organization.",
            "name": "organization_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by user ID. Returns only connected accounts associated with this user.",
            "name": "user_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by connector type (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "name": "connector",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by account identifier. The unique identifier for the connected account within the third-party service (e.g., email address, workspace ID).",
            "name": "identifier",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by OAuth provider. The authentication provider name such as 'google', 'microsoft', 'github', etc.",
            "name": "provider",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of connected accounts to return, up to 99. Defaults to 10 when omitted or 0.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Pagination token from a previous response. Use the next_page_token value from ListConnectedAccountsResponse to fetch the next page.",
            "name": "page_token",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Text search query to filter connected accounts by name, identifier, or other searchable fields. Case-insensitive.",
            "name": "query",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Filter by one or more connection names (exact match). Returns connected accounts belonging to any of the specified connections. Max 20 names per request. Cannot be combined with the `connector` field.",
            "name": "connection_names",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean"
            },
            "description": "Set to `true` to return only the shared credential of an org-wide connection, or `false` to return only users' own accounts. Omit it to return both.",
            "name": "is_org_wide_credential",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The connected accounts that match, with each account's status. Credentials are never included.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsListConnectedAccountsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - occurs when query parameters are malformed or validation fails",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "const response = await scalekit.connectedAccounts.listConnectedAccounts({\n  organizationId: 'org_123',\n  pageSize: 20,\n})\nconst connectedAccounts = response.connectedAccounts"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "response = scalekit_client.connected_accounts.list_connected_accounts(\n    organization_id=\"org_123\",\n    page_size=20,\n)\n# with_call returns (response, call)\nconnected_accounts = response[0].connected_accounts"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// Connected Accounts are not available in the Go SDK public API yet.\n// Use the REST API (GET /api/v1/connected_accounts) or the Node.js/Python SDKs."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// Connected Accounts are not part of the Java SDK public API yet.\n// Use the REST API (GET /api/v1/connected_accounts) or the Node.js/Python SDKs."
          }
        ]
      },
      "put": {
        "description": "Updates authentication credentials and configuration for an existing connected account. Modify OAuth tokens, refresh tokens, access scopes, or API configuration settings. Specify the account by ID, or by combination of organization/user, connector, and identifier. Returns the updated account with new token expiry and status information.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Update connected account credentials",
        "operationId": "ConnectedAccountService_UpdateConnectedAccount",
        "responses": {
          "200": {
            "description": "Connected account updated successfully with new credentials or configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsUpdateConnectedAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required fields, invalid authorization details, or validation failed",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Connected account not found - the specified account does not exist",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connected_accountsUpdateConnectedAccountRequest"
              }
            }
          },
          "required": true
        }
      },
      "post": {
        "description": "Creates a connected account for one user and one connection, with credentials your app already holds: OAuth tokens, or an API key or other static credentials. To have the user connect their own account instead, send them an authorization link. Returns the account with its ID and status.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Create a connected account",
        "operationId": "ConnectedAccountService_CreateConnectedAccount",
        "responses": {
          "200": {
            "description": "Connected account created successfully with authentication credentials stored securely",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsCreateConnectedAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required fields, invalid authorization details, or validation failed. Error code `RESOURCE_ALREADY_EXISTS` when the user already has a connected account on this connection; update it instead.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no connection with this name exists in the environment. Error code `RESOURCE_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connected_accountsCreateConnectedAccountRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connected_accounts/auth": {
      "get": {
        "description": "Retrieves complete authentication details for a connected account including OAuth tokens, refresh tokens, scopes, and API configuration. Query by account ID or by combination of organization/user, connector, and identifier. Returns sensitive credential information - use appropriate access controls.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Get connected account auth credentials",
        "operationId": "ConnectedAccountService_GetConnectedAccountAuth",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "name": "organization_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "name": "user_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "name": "connector",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "name": "identifier",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier for the connected account",
            "name": "id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved connected account with full authentication details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsGetConnectedAccountByIdentifierResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required query parameters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Connected account not found - no account matches the specified criteria",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connected_accounts/details": {
      "get": {
        "description": "Returns metadata for a connected account including status, connector type, provider, and configuration without exposing stored authorization credentials. Look up by account ID, or by a combination of organization (or user), connector, and external identifier.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Get connected account metadata",
        "operationId": "ConnectedAccountService_GetConnectedAccountDetails",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "name": "organization_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "name": "user_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "name": "connector",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "name": "identifier",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier for the connected account",
            "name": "id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved connected account details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsGetConnectedAccountByIdentifierResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required query parameters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Connected account not found - no account matches the specified criteria",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connected_accounts/magic_link": {
      "post": {
        "description": "Creates a one-time authorization link for connecting or re-authorizing a user's account on one connection, creating the connected account first if it doesn't exist. The link takes the user to the app's consent screen, or to a form for their credentials. Returns the link and when it expires, 5 minutes after you create it.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Get an authorization link",
        "operationId": "ConnectedAccountService_GetMagicLinkForConnectedAccount",
        "responses": {
          "200": {
            "description": "Authorization link created, with its expiry time",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsGetMagicLinkForConnectedAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required parameters, or a malformed connected account ID",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no connection with this name exists in the environment. Error code `RESOURCE_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connected_accountsGetMagicLinkForConnectedAccountRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connected_accounts/user/verify": {
      "post": {
        "description": "Confirms the user assertion and activates the connected account after the user completes third-party OAuth. Called by the B2B app server with auth_request_id and identifier. Validates that the asserted identifier matches the one stored on the auth request and promotes pending tokens to live.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Verify connected account user",
        "operationId": "ConnectedAccountService_VerifyConnectedAccountUser",
        "responses": {
          "200": {
            "description": "Verification successful; connected account is now ACTIVE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsVerifyConnectedAccountUserResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed fields",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "403": {
            "description": "Forbidden - identifier mismatch",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no pending flow for the given auth_request_id or already consumed",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connected_accountsVerifyConnectedAccountUserRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connected_accounts:delete": {
      "post": {
        "description": "Deletes the account and the credentials Scalekit stores for it. It doesn't revoke the user's grant at the app. Identify the account by ID, or by its connector and identifier. This can't be undone.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Delete a connected account",
        "operationId": "ConnectedAccountService_DeleteConnectedAccount",
        "responses": {
          "200": {
            "description": "Connected account deleted, with the credentials Scalekit stored for it",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Invalid request - malformed parameters or validation failed. Error code `MCP_SERVER_EXISTS_FOR_CONNECTED_ACCOUNT` when a Virtual MCP server instance for this user still uses the account; delete that Virtual MCP server first.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Connected account not found - the specified account does not exist",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connected_accountsDeleteConnectedAccountRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connected_accounts:search": {
      "get": {
        "description": "Search for connected accounts in your environment using a text query that matches against identifiers, providers, or connectors. The search performs case-insensitive matching across account details. Returns paginated results with account status and authentication type information.",
        "tags": [
          "Connected Accounts"
        ],
        "summary": "Search connected accounts",
        "operationId": "ConnectedAccountService_SearchConnectedAccounts",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Search term to match against connected account identifiers, providers, or connectors. Must be at least 3 characters. Case insensitive.",
            "name": "query",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of connected accounts to return per page. Value must be between 1 and 30.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Token from a previous response for pagination. Provide this to retrieve the next page of results.",
            "name": "page_token",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Connection ID to filter connected accounts",
            "name": "connection_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved matching connected accounts with pagination support",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connected_accountsSearchConnectedAccountsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - query parameter is too short (minimum 3 characters) or validation failed",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/agentkit/connection": {
      "get": {
        "description": "Lists the connections in the environment, newest first, without their settings. Filter by connector, or search by name. Use it to find a connection's name or ID, or to check whether a connector already has a connection; call [Get a connection](/agentkit/reference/connections/get-a-connection/) for one connection's settings.",
        "tags": [
          "App Connections"
        ],
        "summary": "List connections",
        "operationId": "ConnectionService_ListAppConnectionSummaries",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "The number of connections to return, up to 100. Defaults to 10.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The `next_page_token` from the previous response, to get the next page. Leave it out for the first page.",
            "name": "page_token",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Return only connections for this connector, by its identifier, such as `GMAIL`. A connection's `provider` field holds the same value.",
            "name": "provider",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Return connections whose name, connector or connector display name contains this text, such as `gmail`. At least 3 characters.",
            "name": "query",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The connections on this page, with the token for the next page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connectionsListAppConnectionSummariesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - for example, `query` is shorter than 3 characters.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "description": "Creates a connection for a connector, such as Gmail. The connection's type comes from the connector, and an OAuth connection starts with the connector's endpoints and default scopes.\n\nNext, register an OAuth app with the provider using the `redirect_uri` from the response, then add its client ID, client secret and the scopes you need with [Update a connection](/agentkit/reference/connections/update-a-connection/).",
        "tags": [
          "App Connections"
        ],
        "summary": "Create a connection",
        "operationId": "ConnectionService_CreateAppConnection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/v1connectionsCreateAppConnection"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The connection that was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connectionsCreateAppConnectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - the connector is missing or unknown, or the connection name is already used or reserved. Error code `DUPLICATE_IDENTIFIER` when the name is already used.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/agentkit/connection/{connection_identifier}": {
      "get": {
        "description": "Returns a connection with its settings, looked up by its name or its ID. Use it to check the scopes the connection requests, or to copy its `redirect_uri` into the app you registered with the provider. Secrets come back masked.",
        "tags": [
          "App Connections"
        ],
        "summary": "Get a connection",
        "operationId": "ConnectionService_GetAppConnection",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The connection's name, such as `gmail-work`, or its ID, such as `conn_70219645518265104`. Both are in the [List connections](/agentkit/reference/connections/list-connections/) response.",
            "name": "connection_identifier",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The connection and its settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connectionsGetAppConnectionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no connection with this name or ID. Error code `RESOURCE_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/agentkit/connection/{connection_id}": {
      "patch": {
        "description": "Changes a connection's name or settings. Send only the fields you want to change; everything else keeps its current value, including the stored client secret. To clear a list or a map, send it empty (`[]` or `{}`).\n\nTo see the current settings first, call [Get a connection](/agentkit/reference/connections/get-a-connection/). Sending your own `client_id` or `client_secret` switches the connection to your credentials, unless you also set `use_scalekit_creds`.",
        "tags": [
          "App Connections"
        ],
        "summary": "Update a connection",
        "operationId": "ConnectionService_UpdateAppConnection",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The connection's ID, such as `conn_70219645518265104`. Use the ID, not the name. Find it in the `id` field of the [Create](/agentkit/reference/connections/create-a-connection/), [Get](/agentkit/reference/connections/get-a-connection/) or [List connections](/agentkit/reference/connections/list-connections/) response.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/connectionsAppConnectionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The connection with its new settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/connectionsUpdateAppConnectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - for example, an unknown field, a name that is already used, settings that don't match the connection's type, `required_scopes` that aren't all in `scopes`, or `use_scalekit_creds` on a connector that doesn't offer Scalekit credentials.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no connection with this ID. Error code `RESOURCE_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connections/{connection_id}": {
      "delete": {
        "description": "Deletes a connection. It fails while connected accounts or Virtual MCP servers still use the connection. Delete its connected accounts first with [Delete a connected account](/agentkit/reference/connected-accounts/delete-a-connected-account/), and remove it from each server with [Update a Virtual MCP server](/agentkit/reference/virtual-mcp-servers/update-a-virtual-mcp-server/).",
        "tags": [
          "App Connections"
        ],
        "summary": "Delete a connection",
        "operationId": "ConnectionService_DeleteEnvironmentConnection",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The connection's ID, such as `conn_70219645518265104`. Find it in the `id` field of the [List connections](/agentkit/reference/connections/list-connections/) response.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The connection was deleted."
          },
          "400": {
            "description": "Invalid request - connected accounts or Virtual MCP servers still use the connection.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no connection with this ID. Error code `RESOURCE_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/custom-providers": {
      "post": {
        "description": "Creates an environment-scoped custom provider (connector) with authentication patterns and optional proxy configuration. The returned identifier must be used for all subsequent update and delete operations on this provider.",
        "tags": [
          "Connectors"
        ],
        "summary": "Create a custom provider",
        "operationId": "ProviderService_CreateCustomProvider",
        "responses": {
          "200": {
            "description": "Returns the newly created custom provider, including its system-generated identifier and configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/providersCreateProviderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - the provider payload failed validation (e.g. missing required fields or invalid proxy URL)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "Details of the custom connected app provider to create. Identifier is derived by the system and the identifier returned in the response must be used for update and delete operations.",
                "$ref": "#/components/schemas/v1providersCreateCustomProvider"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/custom-providers/{identifier}": {
      "put": {
        "description": "Updates an existing environment-scoped custom provider (connector) by its identifier. Only the fields provided in the request are modified.",
        "tags": [
          "Connectors"
        ],
        "summary": "Update a custom provider",
        "operationId": "ProviderService_UpdateCustomProvider",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Identifier of the custom connected app provider to update.",
            "name": "identifier",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the updated custom provider with its current configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/providersUpdateProviderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - the update payload failed validation",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - no custom provider exists with the given identifier",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "Fields to update for the custom connected app provider. This aligns with the create custom provider payload.",
                "$ref": "#/components/schemas/v1providersUpdateCustomProvider"
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "description": "Deletes an environment-scoped custom provider (connector) by its identifier. This operation is permanent and removes the provider definition from the environment.",
        "tags": [
          "Connectors"
        ],
        "summary": "Delete a custom provider",
        "operationId": "ProviderService_DeleteCustomProvider",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "name": "identifier",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The custom provider was successfully deleted (no content returned)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/providersDeleteProviderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - error code `PROVIDER_HAS_EXISTING_CONNECTIONS` when a connection still uses the connector. Delete its connections first.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - no custom provider exists with the given identifier",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/execute_tool": {
      "post": {
        "description": "Executes a tool action using authentication credentials from a connected account. Specify the tool by name and provide required parameters as JSON. The connected account can be identified by ID, or by combination of organization/user, connector, and identifier. Returns the execution result data and a unique execution ID for tracking. Use this endpoint to perform actions like sending emails, creating calendar events, or managing resources in external services.",
        "tags": [
          "Tool Calling"
        ],
        "summary": "Execute a tool using a connected account",
        "operationId": "ToolService_ExecuteTool",
        "responses": {
          "200": {
            "description": "Tool executed successfully with result data and execution ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/toolsExecuteToolResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - error code `INVALID_ARGUMENT` when the tool name is missing, the input doesn't match the tool's schema, the connected account belongs to a different app than the tool, or the account isn't `ACTIVE`. Error code `TOOL_ERROR` when the app rejected the call; `tool_error_info.tool_error_code` is `INVALID_ARGUMENT`, `EXECUTION_ERROR`, `INTERNAL_ERROR` or, for a tool from an app's MCP server, `TOOL_ERROR`, and `tool_error_message` has the app's message.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Error code `UNAUTHENTICATED` when your access token is missing, invalid or expired; get a new token and retry. Error code `TOOL_ERROR` with `tool_error_code` `REAUTHENTICATION_NEEDED` or `UNAUTHENTICATED` when the user's access to the app was revoked or expired; send the user a new authorization link.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "403": {
            "description": "Error code `TOOL_ERROR` with `tool_error_code` `FORBIDDEN` or `PERMISSION_DENIED` - the app refused the call. The account's credentials are valid but lack the scope this tool needs. The connected account stays `ACTIVE`; grant the missing scope on the connection, have the user authorize again, then retry.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the tool or the connected account doesn't exist. Error code `TOOL_ERROR` with `tool_error_code` `RESOURCE_NOT_FOUND` when the app couldn't find what the call refers to, such as an event ID.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Error code `TOOL_ERROR` with `tool_error_code` `RATE_LIMITED` - the app rate-limited the call. Back off and retry.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Error code `TOOL_ERROR` with `tool_error_code` `INTERNAL_ERROR` when Scalekit couldn't run the tool, for example because the connection's auth type isn't supported for this tool. For a tool from an app's MCP server, `tool_error_code` `TOOL_ERROR` when that server failed, rate-limited the call or couldn't be reached; its status is in `tool_error_message`. A retry can run the tool twice, so retry only tools that are safe to repeat, and quote `execution_id` to support.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/toolsExecuteToolRequest"
              }
            }
          },
          "required": true
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "const response = await scalekit.tools.executeTool({\n  toolName: 'gmail_send_message',\n  identifier: 'user@example.com',\n  params: {\n    to: 'team@example.com',\n    subject: 'Hello from Scalekit',\n    body: 'Tool execution succeeded.',\n  },\n})"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "response = scalekit_client.tools.execute_tool(\n    tool_name=\"gmail_send_message\",\n    identifier=\"user@example.com\",\n    params={\n        \"to\": \"team@example.com\",\n        \"subject\": \"Hello from Scalekit\",\n        \"body\": \"Tool execution succeeded.\",\n    },\n)"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// Tool calling (execute_tool) is not available in the Go SDK public API yet.\n// Use the REST API (POST /api/v1/execute_tool) or the Node.js/Python SDKs."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// Tool calling (execute_tool) is not part of the Java SDK public API yet.\n// Use the REST API (POST /api/v1/execute_tool) or the Node.js/Python SDKs."
          }
        ]
      }
    },
    "/api/v1/mcp/configs": {
      "get": {
        "description": "Lists MCP configurations for the current environment. Filter by ID, exact name, provider or MCP server URL, or pass `search` to match part of the name.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "List MCP configurations",
        "operationId": "McpService_ListMcpConfigs",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by MCP configuration id",
            "name": "filter.id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Case-insensitive exact match on configuration name. Allowed characters: letters (a–z, A–Z), digits (0–9), hyphens (-), and underscores (_). Maximum 100 characters.",
            "name": "filter.name",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter configs that include this provider",
            "name": "filter.provider",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter configs by MCP server URL. The UUID is extracted from the last path segment of the URL and used to find the matching configuration.",
            "name": "filter.mcp_server_url",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Look ahead text search on config name",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Number of configs to return per page (max 30)",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Pagination token to fetch the next or previous page",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of MCP configurations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpListMcpConfigsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - bad filter or pagination parameters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "description": "Creates a new MCP configuration with a set of connections and tools.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Create a new MCP configuration",
        "operationId": "McpService_CreateMcpConfig",
        "responses": {
          "200": {
            "description": "The newly created MCP configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpCreateMcpConfigResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing required fields or invalid connection/tool mappings",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "MCP configuration details to create",
                "$ref": "#/components/schemas/mcpMcpConfig"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/mcp/configs/{config_id}": {
      "get": {
        "description": "Returns a single MCP configuration for the current environment by ID.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Fetch an MCP configuration",
        "operationId": "McpService_GetMcpConfig",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the MCP configuration to fetch",
            "name": "config_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The requested MCP configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpGetMcpConfigResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - MCP configuration does not exist",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "put": {
        "description": "Updates the description and connection-to-tool mappings for an existing MCP configuration. The configuration name cannot be changed after creation.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Update an existing MCP configuration",
        "operationId": "McpService_UpdateMcpConfig",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the MCP configuration to update",
            "name": "config_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The updated MCP configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpUpdateMcpConfigResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - malformed payload or invalid mappings",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - MCP configuration does not exist",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpServiceUpdateMcpConfigBody"
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "description": "Deletes the MCP configuration and any associated mappings and instances in the current environment.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Delete an MCP configuration",
        "operationId": "McpService_DeleteMcpConfig",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the MCP configuration to delete",
            "name": "config_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "MCP configuration and associated data deleted successfully",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - MCP configuration does not exist",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/mcp/configs/{config_id}/connected_accounts": {
      "post": {
        "description": "Returns the connected account state for each connection in the MCP configuration for the given user identifier. When include_auth_link is true, creates connected accounts on the fly if they do not exist and returns a fresh authentication link per connection. When include_auth_link is false or omitted, returns the current status of existing connected accounts only — no accounts are created and authentication_link is always empty. Authentication links are only present when the connection has an associated key; if the connection has no key, authentication_link is empty regardless of include_auth_link.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "List connected accounts for an MCP configuration",
        "operationId": "McpService_ListMcpConnectedAccounts",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the MCP configuration",
            "name": "config_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Connected account state returned for each connection in the configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpListMcpConnectedAccountsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - config_id or identifier is missing or invalid",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no MCP configuration exists with the given config_id",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpServiceListMcpConnectedAccountsBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/mcp/configs/{mcp_config_id}/tokens": {
      "post": {
        "description": "Mints a short-lived JWT that represents a user identifier across the connected accounts associated with an MCP configuration. The supplied identifier becomes the token's `sub` claim; the token's `aud` claim is the MCP server URL bound to the configuration. Claims also carry the MCP configuration ID (`mcp_cfg`) and the list of resolved connected-account IDs (`ca_ids`). Use this operation to issue a single credential an MCP server can present on the user's behalf when calling provider tools. The mint fails if any connection mapped to the configuration has no active connected account for the identifier. For a `META` server, the user needn't have connected accounts yet.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Create an MCP session token",
        "operationId": "McpService_CreateMcpSessionToken",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Unique ID of the MCP configuration whose connections back the token. The configuration must exist in the caller's environment.",
            "name": "mcp_config_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Token created successfully; returns the signed JWT and its absolute expiry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpCreateMcpSessionTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - mcp_config_id or identifier is missing or malformed, expiry is outside the 60s-24h window, the MCP configuration has no connections, or a connection has no active connected account for the supplied identifier",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not Found - no MCP configuration exists with the supplied ID in the caller's environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpServiceCreateMcpSessionTokenBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/mcp/connections/{key_id}/tokens": {
      "post": {
        "description": "Mints a short-lived token for one user that an MCP client sends to one connection's MCP server, at `<environment URL>/mcp/v3/connections/{key_id}`, without a Virtual MCP server. The token's `sub` claim is the identifier and its `aud` claim is that server URL, so the token works only there. Use it when an agent needs the tools of exactly one connection.",
        "tags": [
          "MCP Configurations"
        ],
        "summary": "Create an MCP session token for a connection",
        "operationId": "McpService_CreateMcpConnectionSessionToken",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The connection name, as shown in AgentKit > Connections. It's also the last path segment of the connection's MCP server URL.",
            "name": "key_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Token created successfully; returns the signed JWT and its absolute expiry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/mcpCreateMcpSessionTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - `key_id` or `identifier` is missing or malformed, `expiry` is outside the 60s-24h window, `access_level` isn't `FULL` or `READ_ONLY`, the connection isn't an AgentKit connection, or the user has no active account on the connection. Depending on the environment, Scalekit instead creates a pending account for the user and returns a token, so the user can authorize from the MCP client.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no active connection with this name exists in the environment.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpServiceCreateMcpConnectionSessionTokenBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/tools": {
      "get": {
        "description": "Workspace catalog. Fetch tools by provider, identifier, and connector. Use this when you need every tool in the environment, not tools bound to one user. If `filter.summary` is true, returns only tool names.",
        "tags": [
          "Tool Calling"
        ],
        "summary": "List tools",
        "operationId": "ToolService_ListTools",
        "parameters": [
          {
            "schema": {
              "type": "boolean"
            },
            "description": "Return only tool names instead of full tool details",
            "name": "filter.summary",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by tool provider",
            "name": "filter.provider",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Filter by connected account identifier",
            "name": "filter.identifier",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Filter by one or more tool names",
            "name": "filter.tool_name",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Full-text search query to match tools by name or description (e.g., \"gmail get attachment\")",
            "name": "filter.query",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Connector name (e.g., 'My Gmail'). When set together with filter.identifier, resolves to a specific connected account and includes its custom MCP tools in the response.",
            "name": "filter.connector",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Organization ID to scope the connected account lookup",
            "name": "filter.organization_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "User ID to scope the connected account lookup",
            "name": "filter.user_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Connected account ID. Alternative to filter.identifier + filter.connector for directly identifying the connected account whose custom MCP tools should be included.",
            "name": "filter.connected_account_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of tools to return per page",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Token from a previous response for pagination",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of tools matching the filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/toolsListToolsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - malformed filter or pagination parameters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "const res = await scalekit.tools.listTools({\n  pageSize: 50,\n  filter: { query: 'send message' },\n})"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "from scalekit.v1.tools.tools_pb2 import Filter\n\nresponse = scalekit_client.tools.list_tools(\n    filter=Filter(query=\"send message\"),\n    page_size=50,\n)"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// List tools is not available in the Go SDK public API yet.\n// Use GET /api/v1/tools or the Node.js/Python SDKs."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// List tools is not part of the Java SDK public API yet.\n// Use GET /api/v1/tools or the Node.js/Python SDKs."
          }
        ]
      }
    },
    "/api/v1/tools/scoped": {
      "get": {
        "description": "Tools already bound to one connected-account identifier. Use this when you need the list a user or agent is authorized to call (the list you pass to an LLM). Filter by provider, tool name, or connection name. `identifier` is required.",
        "tags": [
          "Tool Calling"
        ],
        "summary": "List scoped tools",
        "operationId": "ToolService_ListScopedTools",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Identifier of the connected account to filter tools",
            "name": "identifier",
            "in": "query",
            "required": true
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Filter by one or more tool providers",
            "name": "filter.providers",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Filter by one or more tool names",
            "name": "filter.tool_names",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Filter by one or more connection names",
            "name": "filter.connection_names",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of tools to return per page",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Token from a previous response for pagination",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of tools scoped to the given connected account identifier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/toolsListScopedToolsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing identifier or malformed filter/pagination parameters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "const res = await scalekit.tools.listScopedTools('user@example.com', {\n  filter: {\n    connectionNames: ['github-connect'],\n  },\n  pageSize: 50,\n})"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "from scalekit.v1.tools.tools_pb2 import ScopedToolFilter\n\nresponse = scalekit_client.tools.list_scoped_tools(\n    \"user@example.com\",\n    filter=ScopedToolFilter(\n        connection_names=[\"github-connect\"],\n    ),\n    page_size=50,\n)"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// List scoped tools is not available in the Go SDK public API yet.\n// Use GET /api/v1/tools/scoped or the Node.js/Python SDKs."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// List scoped tools is not part of the Java SDK public API yet.\n// Use GET /api/v1/tools/scoped or the Node.js/Python SDKs."
          }
        ]
      }
    },
    "/api/v1/tools/available": {
      "get": {
        "description": "Tools that can be made available for a connected-account identifier. Use this when you need the candidate set for an identifier, not the tools already scoped to it. `identifier` is required. Distinct from GET /api/v1/tools/scoped.",
        "tags": [
          "Tool Calling"
        ],
        "summary": "List available tools",
        "operationId": "ToolService_ListAvailableTools",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "Identifier of the connected account to list available tools for",
            "name": "identifier",
            "in": "query",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of tools to return per page",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Token from a previous response for pagination",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of tools available for the identifier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/toolsListAvailableToolsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed identifier",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Identifier not found",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "const res = await scalekit.tools.listAvailableTools('user@example.com', {\n  pageSize: 50,\n})"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "# list_available_tools is not in the Python SDK.\n# Use GET /api/v1/tools/available?identifier=user@example.com&page_size=50"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// List available tools is not available in the Go SDK public API yet.\n// Use GET /api/v1/tools/available or the Node.js SDK."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// List available tools is not part of the Java SDK public API yet.\n// Use GET /api/v1/tools/available or the Node.js SDK."
          }
        ]
      }
    },
    "/api/v1/tools:search": {
      "post": {
        "description": "Ranks tools in the environment against a natural-language query and returns the best matches, drawn from every connection enabled in the environment. Pass `identifier` to also annotate each result with per-connection readiness (`TOOL_READINESS_STATE_READY`, `TOOL_READINESS_STATE_NEEDS_CONNECTION`, `TOOL_READINESS_STATE_NEEDS_REAUTH`) for that identifier, so you can gate execution on the right auth step before calling ExecuteTool. An empty `connections` array means the identifier has no connection at all for that tool's provider -- not an error, and distinct from `TOOL_READINESS_STATE_NEEDS_CONNECTION` (a connected account exists but is inactive).",
        "tags": [
          "Tool Calling"
        ],
        "summary": "Search tools by query",
        "operationId": "ToolService_SearchTools",
        "responses": {
          "200": {
            "description": "Ranked tools matching the query, with per-identifier readiness when an identifier is supplied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/toolsSearchToolsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - the query is empty or exceeds the maximum length",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Authentication required - missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/toolsSearchToolsRequest"
              }
            }
          },
          "required": true
        },
        "x-codeSamples": [
          {
            "label": "Node.js SDK",
            "lang": "javascript",
            "source": "import { ToolReadinessState } from '@scalekit-sdk/node'\n\nconst res = await scalekit.tools.searchTools('send a message to a slack channel', {\n  identifier: 'user@example.com',\n  topK: 10,\n})\n\nfor (const tool of res.tools) {\n  console.log(tool.name, tool.score)\n  for (const connection of tool.connections) {\n    // readinessState is a number at runtime -- always compare against the\n    // named enum constant, never a raw number or a string.\n    const isReady = connection.readinessState === ToolReadinessState.READY\n    console.log(' ', connection.connectionName, isReady, connection.connectedAccountId)\n  }\n}"
          },
          {
            "label": "Python SDK",
            "lang": "python",
            "source": "from scalekit.v1.tools.tools_pb2 import TOOL_READINESS_STATE_READY\n\nresponse = scalekit_client.tools.search_tools(\n    query=\"send a message to a slack channel\",\n    identifier=\"user@example.com\",\n    top_k=10,\n)\n\nfor tool in response[0].tools:\n    print(tool.name, tool.score)\n    for connection in tool.connections:\n        # readiness_state is an int at runtime -- always compare against the\n        # named enum constant, never a raw int or a string.\n        is_ready = connection.readiness_state == TOOL_READINESS_STATE_READY\n        print(\" \", connection.connection_name, is_ready, connection.connected_account_id)"
          },
          {
            "label": "Go SDK",
            "lang": "go",
            "source": "// Search tools is not available in the Go SDK public API yet.\n// Use POST /api/v1/tools:search or the Node.js/Python SDKs."
          },
          {
            "label": "Java SDK",
            "lang": "java",
            "source": "// Search tools is not part of the Java SDK public API yet.\n// Use POST /api/v1/tools:search or the Node.js/Python SDKs."
          }
        ]
      }
    },
    "/api/v1/connections/{connection_id}/trigger-ingress": {
      "get": {
        "description": "Retrieves the webhook URL a provider sends this connection's events to, and the state of its signing secret. Use this endpoint while setting up a webhook trigger: paste the URL into the provider's app configuration, and check whether a signing secret is set and whether a rotation is in progress. Pass the connection ID in the path. This endpoint never creates a URL; create one first with CreateTriggerIngressEndpoint. The signing secret itself is never returned. Returns the endpoint ID, the URL, whether a signing secret is set, a masked form of the secret showing at most its last four characters, and the rotation state, including signing_secret_rotation_id to pass to ConfirmTriggerSigningSecretRotation.",
        "tags": [
          "Triggers"
        ],
        "summary": "Get a connection's webhook URL",
        "operationId": "TriggerService_GetTriggerIngressEndpoint",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The connection's webhook URL, its masked signing-secret state, and any rotation in progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersTriggerIngressEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no webhook URL has been created for this connection yet (error_code TRIGGER_INGRESS_ENDPOINT_NOT_CREATED; call CreateTriggerIngressEndpoint), the connection does not exist in this environment (error_code RESOURCE_NOT_FOUND), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the webhook URL or its signing-secret state could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "description": "Creates the webhook URL a provider sends this connection's events to. Use this endpoint once per connection when you set up a webhook trigger: paste the returned URL into the provider's app configuration, then store the provider's signing secret with SetTriggerSigningSecret. Pass the connection ID in the path; the request has no body. Only a connection whose provider publishes at least one webhook trigger can have a webhook URL. The call is idempotent: when the connection already has a URL, that URL is returned unchanged, so a retry never replaces a URL already registered with the provider. The URL accepts request bodies up to 1 MB. Returns the endpoint ID, the URL and the signing-secret state; the signing secret itself is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Create a connection's webhook URL",
        "operationId": "TriggerService_CreateTriggerIngressEndpoint",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The newly created webhook URL, or the connection's existing one unchanged, with its signing-secret state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersTriggerIngressEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing created - connection_id is not a valid connection ID; the connection's provider publishes no webhook trigger, so it has no use for a webhook URL (error_code TRIGGER_INGRESS_NOT_APPLICABLE); or the provider's webhook trigger definitions are temporarily unavailable (error_code TRIGGER_INGRESS_DEFINITIONS_UNAVAILABLE)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection does not exist in this environment, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the webhook URL could not be created or read back; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-ingress/signing-secret": {
      "put": {
        "description": "Stores the secret the provider signs its webhook events with, so events sent to the connection's webhook URL can be verified. Use this endpoint after CreateTriggerIngressEndpoint, with the signing secret copied from the provider's app configuration, and again whenever the provider's secret changes. Pass the connection ID in the path and signing_secret in the body; leading and trailing whitespace is removed before the secret is stored. A provider that sends no signature of its own takes a Scalekit-generated secret from GenerateTriggerSigningSecret instead, and is refused here. Until a secret is set, the webhook URL asks the provider to retry every event instead of accepting it. When a secret is already stored, setting a different one starts a rotation: both secrets are accepted until you confirm the rotation with ConfirmTriggerSigningSecretRotation, or for at most 24 hours. Sending the secret that is already stored changes nothing. Returns the endpoint with its masked secret and rotation state, including the signing_secret_rotation_id to confirm; the secret itself is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Set a connection's webhook signing secret",
        "operationId": "TriggerService_SetTriggerSigningSecret",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The secret is stored; the endpoint's masked secret and rotation state, including whether a rotation is now in progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersTriggerIngressEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing written - connection_id is not a valid connection ID; signing_secret is shorter than 8 characters once leading and trailing whitespace is removed, or longer than 4096 characters; the connection's provider sends no signature of its own, so its secret is generated by Scalekit rather than set (error_code TRIGGER_SIGNING_SECRET_GENERATED_ONLY; call GenerateTriggerSigningSecret instead); or the provider's webhook trigger definitions are temporarily unavailable (error_code TRIGGER_INGRESS_DEFINITIONS_UNAVAILABLE)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no webhook URL has been created for this connection yet (error_code TRIGGER_INGRESS_ENDPOINT_NOT_CREATED; call CreateTriggerIngressEndpoint first), the connection does not exist in this environment (error_code RESOURCE_NOT_FOUND), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "409": {
            "description": "Conflict - a rotation is already in progress. Confirm it with ConfirmTriggerSigningSecretRotation, or wait for the previous secret's expiry, before setting another secret",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the signing secret could not be stored; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceSetTriggerSigningSecretBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-ingress/signing-secret/confirm": {
      "post": {
        "description": "Ends a signing-secret rotation by retiring the previous secret, so only the current secret is accepted. Call this endpoint once the provider's app configuration holds the new secret. A rotation is never confirmed automatically: until you call this endpoint, the previous secret stays accepted until its expiry, at most 24 hours after the rotation started. Pass the connection ID in the path, and in the body the signing_secret_rotation_id from the latest SetTriggerSigningSecret or GetTriggerIngressEndpoint response, so that only the rotation you looked at is confirmed. Calling this endpoint when no rotation is in progress succeeds and changes nothing. Returns the endpoint with its masked secret and rotation state.",
        "tags": [
          "Triggers"
        ],
        "summary": "Confirm a signing secret rotation",
        "operationId": "TriggerService_ConfirmTriggerSigningSecretRotation",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The previous secret is retired, or no rotation was in progress; the endpoint's current signing-secret state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersTriggerIngressEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID, or a rotation is in progress and signing_secret_rotation_id is missing or does not match it, for example because a newer rotation has started. The message names the current rotation ID; read the endpoint again with GetTriggerIngressEndpoint before confirming",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no webhook URL has been created for this connection yet (error_code TRIGGER_INGRESS_ENDPOINT_NOT_CREATED; call CreateTriggerIngressEndpoint first), the connection does not exist in this environment (error_code RESOURCE_NOT_FOUND), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the rotation could not be confirmed; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceConfirmTriggerSigningSecretRotationBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-ingress/signing-secret/generate": {
      "post": {
        "description": "Generates a random signing secret for a connection's webhook URL, stores it, and returns it in plain text together with the URL that carries it. Use this endpoint for a provider that sends no signature of its own (provides_bearer_secret is true on its triggers), after CreateTriggerIngressEndpoint. Pass the connection ID in the path; the body is empty. The provider presents the secret back on every event, in an `Authorization: Bearer <secret>` header, the `X-Scalekit-Webhook-Secret` header, or the final path segment of url_with_secret, and an event without it is rejected. The first call on an endpoint with no secret sets one. A call where a secret already exists starts a rotation rather than replacing it, exactly as SetTriggerSigningSecret does: both secrets are accepted until you confirm the rotation with ConfirmTriggerSigningSecretRotation, or for at most 24 hours. A provider that signs its own events takes its secret from its app configuration through SetTriggerSigningSecret instead, and is refused here. Returns the secret in plain text, url_with_secret, and the endpoint with its masked secret and rotation state. The plain-text secret appears only in this response and is never returned again; generate another if it is lost.",
        "tags": [
          "Triggers"
        ],
        "summary": "Generate a connection's signing secret",
        "operationId": "TriggerService_GenerateTriggerSigningSecret",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The connection whose webhook URL receives the generated secret. Between 1 and 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The generated secret in plain text, the webhook URL with the secret appended, and the endpoint's state, including whether a rotation is now in progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersGenerateTriggerSigningSecretResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing written - connection_id is not a valid connection ID; the connection's provider signs its own events, so its secret is copied from the provider's app configuration and stored with SetTriggerSigningSecret instead (error_code TRIGGER_SIGNING_SECRET_NOT_GENERATABLE); or the provider's webhook trigger definitions are temporarily unavailable (error_code TRIGGER_INGRESS_DEFINITIONS_UNAVAILABLE)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no webhook URL has been created for this connection yet (error_code TRIGGER_INGRESS_ENDPOINT_NOT_CREATED; call CreateTriggerIngressEndpoint first), the connection does not exist in this environment (error_code RESOURCE_NOT_FOUND), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "409": {
            "description": "Conflict - a rotation is already in progress. Confirm it with ConfirmTriggerSigningSecretRotation, or wait for the previous secret's expiry, before generating another secret",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the secret could not be generated or stored, or the endpoint could not be read back; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceGenerateTriggerSigningSecretBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-subscriptions": {
      "get": {
        "description": "Lists the trigger subscriptions on a connection, newest first. Use this endpoint to show which accounts are subscribed to which triggers, and to check whether each subscription is delivering. Pass the connection ID in the path. Filter by trigger_name and statuses, and page with page_size and page_token. For a polled trigger, each subscription returns both the interval you requested and the interval it actually runs at, which can be slower when the environment's polling budget is shared across many subscriptions. A polled subscription also returns its poll state: when it last ran, why the last run failed, and whether polling is backed off. Returns one page of subscriptions, the next and previous page tokens, total_size, and status_counts, which counts subscriptions per status across every page.",
        "tags": [
          "Triggers"
        ],
        "summary": "List trigger subscriptions on a connection",
        "operationId": "TriggerService_ListTriggerSubscriptions",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Narrows the list to one trigger's subscriptions. Omit it to list every subscription on the connection.",
            "name": "trigger_name",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "enum": [
                  "ACTIVE",
                  "THROTTLED",
                  "PAUSED",
                  "PAUSED_CREDENTIAL"
                ],
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Narrows the list to subscriptions in these statuses, at most 4. Omit it for every status; TRIGGER_SUBSCRIPTION_STATUS_UNSPECIFIED is refused. Does not affect status_counts, so a client filtering to one status still sees the totals for all of them.\n\n - ACTIVE: Delivering. For a polled trigger, at the requested interval.\n - THROTTLED: Running slower than requested, not stopped. Still delivering.\n - PAUSED: Stopped by the customer.\n - PAUSED_CREDENTIAL: Stopped because the account's credential no longer\nworks. Distinct from PAUSED so the two have distinguishable explanations for missing events.",
            "name": "statuses",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "How many subscriptions to return. Defaults to 10; a larger value than 100 is capped at 100 rather than refused.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The next_page_token or prev_page_token from a previous response. Omit it to read the first page. A value that is not a token from a previous response is refused with 400.",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the connection's trigger subscriptions, plus page tokens, the total match count and per-status counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListTriggerSubscriptionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID, page_token is not a token from a previous response, or statuses holds TRIGGER_SUBSCRIPTION_STATUS_UNSPECIFIED or an unknown status",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection does not exist in this environment, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the subscriptions could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "description": "Creates a subscription to one trigger, either for one connected account or for the whole connection. Use this endpoint after ListAvailableTriggers and ListEligibleAccounts have shown that the trigger and account can be used. Pass the connection ID in the path, and trigger_name in the body. For an account-scoped trigger, pass connected_account_id; for a connection-scoped trigger, omit it. Use config to set the trigger's filter values, with keys spelled exactly as the trigger's config_fields declare them. For a polled trigger, interval_seconds sets the polling interval, and defaults to the trigger's default interval. An interval below the trigger's minimum is refused, not rounded up. Each refusal says what to change, for example the missing scope, the minimum interval, or that the account was authorized under a different app. Returns the new subscription with its status, its requested and effective intervals, and the account's health for this trigger.",
        "tags": [
          "Triggers"
        ],
        "summary": "Subscribe to a trigger",
        "operationId": "TriggerService_CreateTriggerSubscription",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The created subscription, including its status, intervals, filter values and the subscribed account's health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersTriggerSubscription"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - the message names what to change. Returned when an ID is malformed; config holds an unknown key, misses a required key, or holds a value longer than 512 characters; interval_seconds is below the trigger's minimum, or is set for a webhook trigger; connected_account_id is missing for an account-scoped trigger, or present for a connection-scoped one; the trigger polls and is connection-scoped, which is not supported; or the account cannot receive the trigger because its grant lacks a required scope or the bot install the trigger needs, it was authorized under a different app, the trigger needs your own provider app, its provider workspace or user is not yet confirmed, or it holds no usable credential",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection or connected account does not exist in this environment, the connected account belongs to a different connection, the connection's provider publishes no trigger with this name, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "409": {
            "description": "Conflict - this account, or this connection for a connection-scoped trigger, already has a subscription to this trigger with exactly these config values",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the subscription could not be created; nothing was created",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "503": {
            "description": "Service unavailable - polling for the new subscription could not be scheduled, so the subscription was not created; retry the same request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceCreateTriggerSubscriptionBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-subscriptions/{subscription_id}": {
      "delete": {
        "description": "Deletes a trigger subscription from a connection. Use this endpoint when an account or connection should stop receiving a trigger's events. Pass the connection ID and the subscription ID in the path; the subscription must belong to that connection. New events no longer match the subscription, and a polled subscription stops polling. Events already handed off for delivery before the delete are not affected. The delete is permanent; to receive the trigger again, create a new subscription. Returns an empty body.",
        "tags": [
          "Triggers"
        ],
        "summary": "Delete a trigger subscription",
        "operationId": "TriggerService_DeleteTriggerSubscription",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the trigger subscription to delete. It must belong to the connection named in the path.",
            "name": "subscription_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The subscription was deleted; empty body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/protobufEmpty"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID, or subscription_id is not a valid trigger subscription ID",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no subscription with this ID exists on this connection in this environment, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the subscription could not be deleted; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-subscriptions:batchCreate": {
      "post": {
        "description": "Subscribes many connected accounts to one trigger with one filter, and reports what happened to each account separately. Use this instead of repeating the single-account call when onboarding a connection that already has many accounts. The call is best-effort rather than all-or-nothing: a refused account does not undo one that succeeded, because refusals here are ordinary rather than exceptional — an account may hold a revoked credential, lack a scope, or already carry this exact filter. Each result names its own outcome, and a refusal names its remedy. Retrying the whole request is safe: an account subscribed by an earlier attempt comes back as already subscribed rather than as an error. A connection-scoped trigger is subscribed on the connection itself rather than per account: send an empty connected_account_ids for it, and the one subscription comes back as a single result with an empty connected_account_id.",
        "tags": [
          "Triggers"
        ],
        "summary": "Subscribe several accounts to a trigger",
        "operationId": "TriggerService_BatchCreateTriggerSubscriptions",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "One result per requested account, in request order, and the number of subscriptions this call created. Individual accounts can still be REFUSED, NOT_FOUND or FAILED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersBatchCreateTriggerSubscriptionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing created - connection_id or an entry of connected_account_ids is malformed; config is invalid for this trigger; interval_seconds is below the trigger's minimum, or is set for a webhook trigger; the trigger polls and is connection-scoped, which is not supported; or connected_account_ids is empty for a trigger that is subscribed per connected account. A well-formed ID naming an account that does not exist is not this case: it comes back as a per-account NOT_FOUND result with a 200, so one bad ID in a batch of a hundred does not discard the ninety-nine that would have succeeded",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection does not exist in this environment, the connection's provider publishes no trigger with this name, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the connection or the trigger's definition could not be read, so no account was processed; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceBatchCreateTriggerSubscriptionsBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/trigger-subscriptions:batchDelete": {
      "post": {
        "description": "Deletes many trigger subscriptions on one connection, and reports what happened to each one separately. Use this endpoint to unsubscribe a selection from the subscription list, or every subscription a set of connected accounts holds to one trigger, instead of calling DeleteTriggerSubscription once per subscription. Pass the connection ID in the path, and name the subscriptions in the body in exactly one of two ways: by `subscription_ids`, or by `trigger_name` together with `connected_account_ids`, which deletes every subscription those accounts hold to that trigger on this connection, whatever its filter. `trigger_name` alone is refused, so no request can delete every subscription to a trigger. The call is best-effort rather than all-or-nothing: a subscription that could not be deleted does not bring back one that was. Retrying the whole request is safe: a subscription deleted by an earlier attempt comes back as NOT_FOUND, so treat DELETED and NOT_FOUND alike as gone. Unlike DeleteTriggerSubscription, which answers 404 for a missing subscription, the batch reports it as one NOT_FOUND result among many. Delivery stops for each deleted subscription exactly as with DeleteTriggerSubscription: an event already handed off for delivery is still delivered. Returns one result per subscription, each with its outcome (DELETED, NOT_FOUND, FAILED, or NOT_ATTEMPTED when the request ran out of time before reaching it) and a reason, plus deleted_count.",
        "tags": [
          "Triggers"
        ],
        "summary": "Delete several trigger subscriptions",
        "operationId": "TriggerService_BatchDeleteTriggerSubscriptions",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection whose subscriptions to delete. Only subscriptions on this connection are deleted: a subscription ID from another connection comes back as NOT_FOUND.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Request processed; every subscription ID, or every subscription found for the named accounts, has its own result in results, and deleted_count says how many subscriptions this call deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersBatchDeleteTriggerSubscriptionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing deleted - both selectors or neither were sent, or `trigger_name` and `connected_account_ids` were not sent together; a list holds more than 100 IDs or repeats one, including two spellings of the same ID; `connection_id` is not a valid connection ID, an entry of `subscription_ids` is not a trigger subscription ID (`trgs_`), or an entry of `connected_account_ids` is not a connected account ID (`ca_`); or the named accounts hold more than 1000 subscriptions to the trigger, so fewer `connected_account_ids` must be sent per request. A well-formed ID naming a subscription that does not exist, was already deleted, or belongs to another connection is not this case: it comes back as a NOT_FOUND result with a 200, so one stale ID does not discard the rest of the batch.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment, or `connection_id` can never name a connection. Nothing was deleted. A missing subscription is not this case: it is a NOT_FOUND result with a 200.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - this environment has sent too many batch delete requests in the last minute. Nothing was deleted; retry after a short wait.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the subscriptions that `trigger_name` and `connected_account_ids` name could not be read, so nothing was deleted. Only that selector fails this way; retrying is safe.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceBatchDeleteTriggerSubscriptionsBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/connections/{connection_id}/triggers": {
      "get": {
        "description": "Lists every trigger the connection's provider publishes, and marks each one as available or unavailable on this connection. Use this endpoint to build a trigger picker, or to find out what a trigger needs before you subscribe to it. Pass the connection ID in the path. A trigger that cannot run on this connection is still returned, with available set to false and a reason, a remedy and, where one applies, a refusal_code. For example, a trigger that needs your own provider app is unavailable while the connection uses Scalekit's shared app. Each trigger describes how it detects events (webhook or poll), its required scopes, its configuration fields, its polling intervals, and whether it needs a signing secret. The response also states whether the connection uses Scalekit's shared provider app. Next, call ListEligibleAccounts to see which connected accounts can receive a trigger.",
        "tags": [
          "Triggers"
        ],
        "summary": "List triggers available on a connection",
        "operationId": "TriggerService_ListAvailableTriggers",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The provider's triggers, each with its availability on this connection, and whether the connection uses Scalekit's shared provider app",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListAvailableTriggersResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection does not exist in this environment, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the triggers for this connection could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/connections/{connection_id}/triggers/{trigger_name}/eligible-accounts": {
      "get": {
        "description": "Lists the connected accounts on a connection, and marks each one as eligible or ineligible for one trigger. Use this endpoint to choose which accounts to subscribe, before calling CreateTriggerSubscription or BatchCreateTriggerSubscriptions. Pass the connection ID and the trigger name in the path. Use query to search account identifiers, and page_size and page_token to page through the results. An ineligible account is returned with a reason and a remedy instead of being left out, so you can see why an account is refused. Each account also carries its health for this trigger: a state, and the single action that resolves it. Returns one page of accounts, the next and previous page tokens, and total_size, which counts the accounts on this connection that match the query.",
        "tags": [
          "Triggers"
        ],
        "summary": "List accounts eligible for a trigger",
        "operationId": "TriggerService_ListEligibleAccounts",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the connection, in this environment. Up to 64 characters.",
            "name": "connection_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Name of the trigger, as returned in the name field of ListAvailableTriggers. Up to 128 characters.",
            "name": "trigger_name",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Narrows the list to accounts whose identifier contains this text, case-insensitively. Matched against every account on the connection, not only the current page. Up to 100 characters.",
            "name": "query",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "How many accounts to return. Defaults to 10; a larger value than 100 is capped at 100 rather than refused.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The next_page_token or prev_page_token from a previous response. Omit it to read the first page. A value that is not a token from a previous response is refused with 400.",
            "name": "page_token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the connection's accounts, each with its eligibility and health for the trigger, plus page tokens and the total match count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListEligibleAccountsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - connection_id is not a valid connection ID, page_token is not a token from a previous response, or query is longer than 100 characters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the connection does not exist in this environment, the connection's provider publishes no trigger with this name, or Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the accounts for this trigger could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-activity": {
      "get": {
        "description": "Returns counts of what happened to the environment's trigger events over the last 24 hours, grouped by outcome. Use this endpoint to diagnose a trigger that did not fire: the counts tell apart events that never arrived, events that arrived and matched no subscription filter, events for a provider workspace that no connected account holds, events that failed signature verification, and events whose handoff for delivery failed. The endpoint takes no parameters and covers every connection in the environment. Counts are aggregates only: no record of an individual event is kept, so no endpoint can explain what happened to one specific event. Returns the counts, the window they cover in hours, whether most recent arrivals failed signature verification, whether the counts are incomplete, and the dashboard path where delivery attempts can be inspected.",
        "tags": [
          "Triggers"
        ],
        "summary": "Get trigger event counts for the environment",
        "operationId": "TriggerService_GetTriggerActivity",
        "responses": {
          "200": {
            "description": "Event counts per outcome for the last 24 hours, with the signature-failure and incomplete-data indicators",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersGetTriggerActivityResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the activity counts could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-delivery/deliveries/{id}": {
      "get": {
        "description": "Finds one trigger event by its message ID or its event ID, and returns every delivery attempt made for it across every delivery endpoint in this environment, oldest first. Use this endpoint when you hold an ID from your own server: the message ID arrives as the `webhook-id` header, and the event ID is the payload's `dedupe_key`. Pass the ID in the path. Attempt IDs (`atmpt_`) are not accepted. Only this environment's deliveries are searched, so an ID from another environment is reported as not found. Returns the event's message ID, event ID and creation time, the trigger subscription, trigger and connection it came from while they still exist, and its attempts, each naming the endpoint and URL it was sent to, with response bodies cut to their first 4096 bytes. Returns at most 50 attempts, the newest 50; `truncated` is true when the event has more. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Find a trigger delivery by ID",
        "operationId": "TriggerService_LookupTriggerDelivery",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "The message ID (`msg_…`, sent to the endpoint as the `webhook-id` header) or the event ID (the payload's `dedupe_key`) of the trigger event to find. 1 to 256 characters: letters, digits, `.`, `_` and `-`. An attempt ID (`atmpt_…`) is refused.",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The event, with its message ID, event ID and creation time, the trigger and connection it came from, and its delivery attempts to every endpoint, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersLookupTriggerDeliveryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - id is empty, longer than 256 characters, contains characters other than letters, digits, `.`, `_` and `-`, or is an attempt ID (`atmpt_`)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - no trigger event with this message ID or event ID exists in this environment (error_code NOT_FOUND), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - deliveries are being read too often. Retry shortly; the request is not retried on your behalf",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the delivery could not be looked up; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-delivery/deliveries:batchLookup": {
      "post": {
        "description": "Finds up to 25 trigger events by message ID or event ID, and returns each one's delivery attempts across every delivery endpoint in this environment, as LookupTriggerDelivery does for one. Use this endpoint when you hold a list of IDs from your own server, for example to check which of a day's events reached you. Pass the IDs in the body, in any mix of message IDs and event IDs. Attempts in a batch result carry no response body; look one delivery up with LookupTriggerDelivery to read the bodies. Only this environment's deliveries are searched, so an ID from another environment comes back as NOT_FOUND. When reads are refused for volume partway through, that ID comes back RATE_LIMITED and the batch stops: IDs not yet looked up come back NOT_ATTEMPTED, to be sent again shortly. The call only reads, so retrying the whole request is always safe. Returns one result per ID, in the order sent, each with its outcome (FOUND with the delivery, NOT_FOUND, RATE_LIMITED, FAILED or NOT_ATTEMPTED) and a reason, plus found_count. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Find several trigger deliveries by ID",
        "operationId": "TriggerService_BatchLookupTriggerDeliveries",
        "responses": {
          "200": {
            "description": "Request processed; every ID has its own result in results, in the order sent, and found_count says how many were found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersBatchLookupTriggerDeliveriesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing looked up - `ids` is empty, holds more than 25 IDs or repeats one; an ID is longer than 256 characters or contains characters other than letters, digits, `.`, `_` and `-`; or an ID is an attempt ID (`atmpt_`), which LookupTriggerDelivery refuses too. A well-formed ID that names no trigger event in this environment is not this case: it comes back as a NOT_FOUND result with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment. An ID that names no trigger event is not this case: it is a NOT_FOUND result with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - this environment has sent too many batch lookup requests in the last minute. Nothing was looked up; retry after a short wait. Reads refused for volume partway through a batch are not this case: they are reported per ID as RATE_LIMITED, with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the environment's trigger deliveries could not be reached, so nothing was looked up; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/triggersBatchLookupTriggerDeliveriesRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/trigger-delivery/deliveries:batchResend": {
      "post": {
        "description": "Queues a new delivery attempt for up to 50 trigger events, each to one delivery endpoint, and reports what happened to each target separately. Use this to retry deliveries that failed, for example a selection from ListTriggerDeliveriesByEndpoint, instead of resending them one at a time. Pass the targets in the body; each names a message ID and the endpoint to deliver that event to again. QUEUED means a new manual attempt was accepted for delivery, not that the event was delivered: the attempt and its outcome appear in ListTriggerDeliveryAttemptsByMessage as a TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_MANUAL attempt. The call is best-effort: a target that fails does not undo one that was queued. Resending is not idempotent: each time a target is sent it queues one more attempt, so after a partial failure retry only the targets that came back RATE_LIMITED, FAILED or NOT_ATTEMPTED, never the whole request. A FAILED target whose request timed out may still have been queued, so retrying it can queue a second attempt. A FAILED target whose event payload is no longer stored can never be resent; its reason says so. When a target is rate limited the batch stops: targets not yet started come back NOT_ATTEMPTED, while a target already in flight finishes with its own outcome. Returns one result per target, in the order sent, each with its outcome and a reason, plus queued_count. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Resend several trigger deliveries",
        "operationId": "TriggerService_BatchResendTriggerDeliveries",
        "responses": {
          "200": {
            "description": "Request processed; every target has its own result in results, in the order sent, and queued_count says how many new attempts this call queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersBatchResendTriggerDeliveriesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, nothing queued - `targets` is empty or holds more than 50; a `msg_id` is not a message ID (`msg_` followed by 1 to 64 letters or digits) or an `endpoint_id` is not an endpoint ID (`ep_` followed by 1 to 64 letters or digits); or the same `msg_id` and `endpoint_id` pair appears twice, since sending it twice would queue two attempts. A well-formed message or endpoint ID that does not exist in this environment is not this case: it comes back as a NOT_FOUND result with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment. Nothing was queued. A message or endpoint that does not exist is not this case: it is a NOT_FOUND result with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - this environment has sent too many batch resend requests in the last minute. Nothing was queued; retry after a short wait. A rate limit reached partway through a batch is not this case: it is reported per target as RATE_LIMITED, with a 200",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the environment's trigger deliveries could not be reached, so nothing was queued; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/triggersBatchResendTriggerDeliveriesRequest"
              }
            }
          },
          "description": "The deliveries to retry. A repeated msg_id and endpoint_id pair is refused by the service:\nunique cannot be declared on a list of messages, and sending the pair twice would queue two\nattempts.",
          "required": true
        }
      }
    },
    "/api/v1/trigger-delivery/endpoints/{endpoint_id}/attempts": {
      "get": {
        "description": "Lists the most recent attempts to deliver trigger events to one of the environment's trigger delivery endpoints, newest first. Use this endpoint to check whether trigger events reached your endpoint, and to inspect the HTTP status and response body each attempt received. Pass the delivery endpoint ID in the path, and optionally page_size, which defaults to 20 and is capped at 100. Only the most recent attempts are returned; there is no page token for older attempts. A failed attempt is retried, so check the newest attempt for a message before concluding it was not delivered. Returns the attempts, each with its status, the HTTP status code and response body your endpoint returned, the message ID, and the time of the attempt.",
        "tags": [
          "Triggers"
        ],
        "summary": "List delivery attempts for a trigger endpoint",
        "operationId": "TriggerService_ListTriggerDeliveryAttemptsByEndpoint",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the trigger delivery endpoint to list attempts for. Must be one of this environment's trigger delivery endpoints.",
            "name": "endpoint_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of attempts to return, newest first. Defaults to 20 when omitted or zero; a larger value than 100 is capped at 100 rather than refused.",
            "name": "page_size",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint's most recent delivery attempts, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListTriggerDeliveryAttemptsByEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - endpoint_id is missing, is longer than 256 characters or contains characters other than letters, digits, `.`, `_` and `-`, or does not name a trigger delivery endpoint in this environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the delivery attempts could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-delivery/endpoints/{endpoint_id}/deliveries": {
      "get": {
        "description": "Lists one page of the trigger events delivered to one delivery endpoint, newest first, with one entry per event however many attempts it took. Use this endpoint to check whether fired triggers reached your endpoint, and to find the deliveries that failed or are still being retried. Pass the delivery endpoint ID in the path. Narrow the list by delivery state (`status`), by the connection or trigger subscription the event came from (`channel`), and by time (`after`, `before`); `page_size` defaults to 20 and is capped at 100. Deliveries are kept for 90 days, so a time range reaching further back is cut to that window, and a range wholly outside it returns an empty page. Pass `next_page_token` back as `page_token`, with the same endpoint and filters, to read older deliveries. Each delivery returns its message ID, event ID, state and, while it is being retried, the time of its next attempt, and names the trigger subscription, trigger, detection mode and connection it came from while they still exist. Read the attempts behind one delivery with ListTriggerDeliveryAttemptsByMessage. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "List trigger deliveries to an endpoint",
        "operationId": "TriggerService_ListTriggerDeliveriesByEndpoint",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the trigger delivery endpoint to list deliveries for. 1-256 characters.",
            "name": "endpoint_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Maximum number of deliveries to return, newest first. Defaults to 20 when omitted or zero; a larger value than 100 is capped at 100 rather than refused.",
            "name": "page_size",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "The next_page_token from a previous response, to read the next page of older deliveries. Omit it to read the newest page. A token is bound to the environment, the endpoint and the filters it was issued with: a token sent with a different endpoint or different filters is refused rather than mixing two result sets. At most 1024 characters.",
            "name": "page_token",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "TRIGGER_DELIVERY_STATUS_DELIVERED",
                "TRIGGER_DELIVERY_STATUS_PENDING",
                "TRIGGER_DELIVERY_STATUS_FAILED",
                "TRIGGER_DELIVERY_STATUS_RETRYING"
              ]
            },
            "description": "Narrows the list to deliveries in this state. Omit it, or send TRIGGER_DELIVERY_STATUS_UNSPECIFIED, for every state.\n\n - TRIGGER_DELIVERY_STATUS_DELIVERED: An attempt succeeded. No further\nattempt is made.\n - TRIGGER_DELIVERY_STATUS_PENDING: Accepted for delivery; no attempt\nhas finished yet.\n - TRIGGER_DELIVERY_STATUS_FAILED: Every scheduled attempt failed. No\nfurther attempt is made unless one is started by hand.\n - TRIGGER_DELIVERY_STATUS_RETRYING: An attempt failed and another is\nscheduled, at next_attempt_at.",
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Narrows the list to deliveries of events from one connection (a `conn_` ID) or one trigger subscription (a `trgs_` ID). The ID must exist in this environment; any other value is refused with 400. At most 64 characters.",
            "name": "channel",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only deliveries of events created after this instant. Omit it to read back to the oldest retained delivery. Deliveries are kept for 90 days, so a value earlier than that is moved forward to the start of the retained window. Refused when later than `before`. Read to the second.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only deliveries of events created before this instant. Omit it to start from the newest delivery. A value later than the current time is treated as the current time. With `after`, reads a time range; the list stays newest first within it. Read to the second.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the endpoint's deliveries, newest first, with a next_page_token when older deliveries exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListTriggerDeliveriesByEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - endpoint_id is missing, is longer than 256 characters, contains characters other than letters, digits, `.`, `_` and `-`, or does not name a trigger delivery endpoint in this environment; status is not a known delivery status; channel is not a connection ID (`conn_`) or trigger subscription ID (`trgs_`) in this environment; `after` or `before` is not a valid timestamp, or `after` is later than `before`; or page_token is malformed or was issued for a different endpoint or set of filters",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - deliveries are being read too often. Retry shortly; the request is not retried on your behalf",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the deliveries could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-delivery/endpoints/{endpoint_id}/deliveries/{msg_id}/attempts": {
      "get": {
        "description": "Lists every attempt made to deliver one trigger event to one delivery endpoint, oldest first: the first attempt, each automatic retry, and any manual retry. Use this endpoint to show how one delivery from ListTriggerDeliveriesByEndpoint went, attempt by attempt. Pass the delivery endpoint ID and the message ID in the path. Each attempt carries its outcome, HTTP status code, response body (cut to its first 4096 bytes, with response_truncated set), response time and the URL it was sent to, and whether it was a scheduled attempt or a manual retry. Returns at most 50 attempts, the newest 50; `truncated` is true when the delivery has more. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "List the attempts behind one delivery",
        "operationId": "TriggerService_ListTriggerDeliveryAttemptsByMessage",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the trigger delivery endpoint the attempts were made to. 1-256 characters.",
            "name": "endpoint_id",
            "in": "path",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Message ID of the delivery, as returned in msg_id by ListTriggerDeliveriesByEndpoint: `msg_` followed by 1 to 64 letters or digits.",
            "name": "msg_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery's attempts, oldest first, with truncated set when more than 50 exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersListTriggerDeliveryAttemptsByMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - endpoint_id is missing, is longer than 256 characters or contains characters other than letters, digits, `.`, `_` and `-`; msg_id is not a message ID (`msg_` followed by 1 to 64 letters or digits); or the endpoint or the message does not exist in this environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - Triggers is not enabled for the environment",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - deliveries are being read too often. Retry shortly; the request is not retried on your behalf",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the attempts could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/trigger-delivery/endpoints/{endpoint_id}:recover": {
      "post": {
        "description": "Starts a recovery that resends every trigger event whose delivery to one endpoint failed within a time window. Use this endpoint once your endpoint is healthy again after an outage, instead of resending each failed delivery with BatchResendTriggerDeliveries. Pass the delivery endpoint ID in the path, and `since` and optionally `until` in the body. The recovery covers events with a failed attempt to this endpoint from `since` up to, not including, `until`. It skips an event that also has a successful attempt to this endpoint within the window, and it never sends an event that was not already sent to this endpoint. The window is at most 14 days; omit `until` to recover up to the present. The recovery runs in the background after this call returns, so the response confirms that it started, not that anything was delivered. Each recovered event gets a new attempt, which appears in ListTriggerDeliveriesByEndpoint and ListTriggerDeliveryAttemptsByMessage like any other. One call recovers at most 10,000 events and stops there without reporting it: when more may have failed, cover the period with several calls over narrower windows. Recovery progress cannot be read through the API. `task_id` identifies this recovery in Scalekit's logs for support, and there is no endpoint to poll it. Not idempotent: calling again re-queues every event that is still failed, and a second call made before the first finishes can queue a second attempt for the same event. Returns the recovery's task_id and its status when this call returned. The event payload is never returned.",
        "tags": [
          "Triggers"
        ],
        "summary": "Resend failed deliveries to an endpoint",
        "operationId": "TriggerService_RecoverTriggerDeliveries",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "ID of the delivery endpoint whose failed deliveries to resend: `ep_` followed by 1 to 64 letters or digits.",
            "name": "endpoint_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The recovery started; includes its task_id and its status when this call returned. Events are resent in the background after this response. In the rare case that the recovery was accepted without an identifier, task_id and status are empty; the recovery still runs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersRecoverTriggerDeliveriesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, no recovery started - `endpoint_id` is not an endpoint ID (`ep_` followed by 1 to 64 letters or digits); `since` is missing, or `since` or `until` is not a valid timestamp; `since` is in the future; `until` is in the future; `until` is not after `since`; or `until` is more than 14 days after `since`, measured to now when `until` is omitted, so the period must be split into several calls",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - the endpoint is not one of this environment's trigger delivery endpoints, or Triggers is not enabled for the environment. No recovery started",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Too many requests - this environment has started too many recoveries in a short period, or requests are being refused for volume. No recovery started; retry after a short wait",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the recovery was not confirmed. Either it could not be started, or the request timed out or failed after it may already have been accepted, in which case the error message says it may be running. In that case look for new manual attempts with ListTriggerDeliveriesByEndpoint before calling again, because a second call can queue a second attempt for the same event",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerServiceRecoverTriggerDeliveriesBody"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/v1/trigger-usage": {
      "get": {
        "description": "Returns the trigger deliveries metered for this environment over a period, either a preset period ending now or a range of UTC calendar dates. Use this endpoint to chart trigger usage, for example the last 24 hours by the hour or the current month by the day. Ask for the period in one of two ways, never both: `period`, or `from` and `to`. With `period=24h` the counts are hourly, in `hours`, for the 24 UTC clock hours ending with the hour in progress, which the response names as `current_hour`; that hour's count grows until it ends. With `period=7d` or `period=30d` the counts are daily, in `days`, for the UTC calendar days ending with today's UTC date: the week ending today, or the 30 days ending today. With `from` and `to` the counts are daily, in `days`, for each UTC calendar day from `from` to `to`, both inclusive. Days follow UTC, not the caller's time zone. One unit is one trigger event sent to one receiving endpoint, so an event delivered to several endpoints counts once for each, and a filtered or duplicate event, a failed handoff, or an event no endpoint receives counts none. Only hours and days with metered units are returned: one with none is absent rather than listed as zero, so fill the gaps yourself over the bounds the response returns. Usage is recorded with a short delay, so the latest deliveries can be missing from the current hour's and today's count for a short while. The readable window is today's UTC date and the 30 days before it, and every `period` falls inside it. A `from` and `to` range that extends past the window is clamped to it: a `from` more than 30 days before today's UTC date reads from the first day of the window, and a `to` after today's UTC date reads through today. A range with no day inside the window is refused, as is a `from` after `to`. Returns the range actually read as `from` and `to`, which differ from the request when it was clamped, the `period` asked for, the size of each entry as `bucket`, and the server's UTC date as `today`, so you can tell the day still in progress apart from completed ones.",
        "tags": [
          "Triggers"
        ],
        "summary": "Get metered trigger usage",
        "operationId": "TriggerService_GetTriggerUsage",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "description": "First UTC calendar date to include, as YYYY-MM-DD. Inclusive. Required when `period` is not sent, and must be left empty when it is. Must be a real date, must not be after `to`, and must not be after today's UTC date. A date more than 30 days before today's UTC date is clamped to the first day of the readable window, 30 days before today.",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "description": "Last UTC calendar date to include, as YYYY-MM-DD. Inclusive. Required when `period` is not sent, and must be left empty when it is. Must be a real date and must not be more than 30 days before today's UTC date. A date after today's UTC date is clamped to today.",
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d"
              ]
            },
            "description": "A preset period ending now, sent instead of `from` and `to`: exactly `24h`, `7d` or `30d`, lowercase. `24h` reads hourly counts for the 24 UTC clock hours ending with the hour in progress. `7d` and `30d` read daily counts for the UTC calendar days ending with today's UTC date: the week ending today, or the 30 days ending today. Leave `from` and `to` empty when this is set; when it is not, both are required.",
            "name": "period",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The metered usage: one entry per hour (`period=24h`, in `hours`) or per UTC day (every other request, in `days`) with metered units, oldest first, plus the range read and today's UTC date",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/triggersGetTriggerUsageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - `period` is not exactly `24h`, `7d` or `30d`; `period` is sent together with `from` or `to`; `period` is not sent and `from` or `to` is missing; a date is not a real calendar date in YYYY-MM-DD form; `from` is after `to`; `from` is after today's UTC date; or `to` is more than 30 days before today's UTC date. A range that only extends past the readable window is clamped, not refused",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Not found - trigger usage is not metered for this environment (error_code TRIGGER_USAGE_NOT_METERED), or Triggers is not enabled for the environment (error_code RESOURCE_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal error - the usage could not be read; retry the request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "503": {
            "description": "Service unavailable - usage data could not be read right now. No partial figures are returned; retry the request later",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "connected_account.created": {
      "post": {
        "summary": "Connected Account Created",
        "description": "Triggered when a new connected account is created",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountCreatedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101531404017336586",
                "type": "connected_account.created",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-01T10:23:52.702980847Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_100668583155073286",
                  "id": "ca_101531404000559370",
                  "identifier": "Bruce",
                  "provider": "CANVA",
                  "status": "PENDING_AUTH"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.updated": {
      "post": {
        "summary": "Connected Account Updated",
        "description": "Triggered when a connected account is updated",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountUpdatedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101652975398683158",
                "type": "connected_account.updated",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T06:31:34.895815554Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_100510054016352776",
                  "id": "ca_100510623602835982",
                  "identifier": "Pranesh",
                  "provider": "SUPABASE",
                  "status": "PENDING_AUTH"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.status_updated": {
      "post": {
        "summary": "Connected Account Status Updated",
        "description": "Triggered when a connected account's status changes between two states (for example PENDING_AUTH to ACTIVE, ACTIVE to EXPIRED, or any state to DISCONNECTED). Not triggered on account creation.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountStatusUpdatedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101652975398683158",
                "type": "connected_account.status_updated",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T06:31:34.895815554Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_133400101014995480",
                  "connection_name": "gmail",
                  "id": "ca_133400349586228019",
                  "identifier": "john@acmecorp.com",
                  "provider": "GMAIL",
                  "status": "EXPIRED",
                  "old_status": "ACTIVE"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.deleted": {
      "post": {
        "summary": "Connected Account Deleted",
        "description": "Triggered when a connected account is deleted",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountDeletedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101653010731500290",
                "type": "connected_account.deleted",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T06:31:55.954027187Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_101644109747323155",
                  "id": "ca_101649788113519113",
                  "identifier": "Clark",
                  "last_used_at": "2025-12-02T06:00:01.374253Z",
                  "provider": "GOOGLE_ADS",
                  "status": "ACTIVE",
                  "token_expires_at": "2025-12-02T06:59:57.237447Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.magic_link_generated": {
      "post": {
        "summary": "Connected Account Magic Link Generated",
        "description": "Triggered when an authorization link is created for a user",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountMagicLinkGeneratedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101652975398683158",
                "type": "connected_account.magic_link_generated",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T06:31:34.895815554Z",
                "environment_id": "env_88640229614813448",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_100510054016352776",
                  "id": "ca_100510623602835982",
                  "identifier": "Pranesh",
                  "provider": "SUPABASE",
                  "status": "PENDING_AUTH"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.oauth_tokens_fetched": {
      "post": {
        "summary": "Connected Account OAuth Tokens Fetched",
        "description": "Triggered when OAuth tokens are successfully fetched",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountOauthTokensFetchedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101649795042509316",
                "type": "connected_account.oauth_tokens_fetched",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T05:59:59.250126407Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_101644109747323155",
                  "id": "ca_101649788113519113",
                  "identifier": "Clark",
                  "provider": "GOOGLE_ADS",
                  "status": "ACTIVE",
                  "token_expires_at": "2025-12-02T06:59:57.237447778Z"
                },
                "display_name": "OAuth tokens fetched"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.token_refresh_succeeded": {
      "post": {
        "summary": "Connected Account Token Refresh Succeeded",
        "description": "Triggered when token refresh succeeds",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountTokenRefreshSucceededEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101651946317808143",
                "type": "connected_account.token_refresh_succeeded",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T06:21:21.517480021Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_101644109747323155",
                  "id": "ca_101644170698948883",
                  "identifier": "Pranesh",
                  "last_used_at": "2025-12-02T06:21:21.393723232Z",
                  "provider": "GOOGLE_ADS",
                  "status": "ACTIVE",
                  "token_expires_at": "2025-12-02T07:21:20.508197312Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.token_refresh_failed": {
      "post": {
        "summary": "Connected Account Token Refresh Failed",
        "description": "Triggered when token refresh fails",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountTokenRefreshFailedEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101649795042509316",
                "type": "connected_account.token_refresh_failed",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T05:59:59.250126407Z",
                "environment_id": "env_88640229614813445",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_101644109747323155",
                  "id": "ca_101649788113519113",
                  "identifier": "Clark",
                  "provider": "GOOGLE_ADS",
                  "status": "ACTIVE",
                  "token_expires_at": "2025-12-02T06:59:57.237447778Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    },
    "connected_account.oauth_succeeded": {
      "post": {
        "summary": "Connected Account OAuth Succeeded",
        "description": "Triggered when OAuth authentication succeeds",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedAccountOauthSucceededEvent"
              },
              "example": {
                "spec_version": "1",
                "id": "evt_101649484227871236",
                "type": "connected_account.oauth_succeeded",
                "object": "ConnectedAccount",
                "occurred_at": "2025-12-02T05:56:53.994604757Z",
                "environment_id": "env_88640229614813449",
                "data": {
                  "authorization_type": "OAUTH",
                  "connection_id": "conn_101644109747323155",
                  "id": "ca_101649474950005257",
                  "identifier": "Bruce",
                  "provider": "GOOGLE_ADS",
                  "status": "ACTIVE",
                  "token_expires_at": "2025-12-02T06:56:52.976081699Z"
                },
                "display_name": "OAuth authentication successful"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "McpServiceCreateMcpSessionTokenBody": {
        "type": "object",
        "required": [
          "identifier"
        ],
        "properties": {
          "access_level": {
            "description": "Which tools the token can use. `READ_ONLY` limits it to the server's read-only tools; other tools are left out of `tools/list` and refused when called. `FULL`, or omitting the field, gives every tool the server serves. Case-sensitive.",
            "type": "string",
            "enum": [
              "FULL",
              "READ_ONLY"
            ],
            "examples": [
              "READ_ONLY"
            ]
          },
          "expiry": {
            "description": "Optional token lifetime. Must be between 60s and 24h. Defaults to 1h when omitted.",
            "type": "string",
            "examples": [
              "3600s"
            ]
          },
          "identifier": {
            "description": "Upstream-provider identifier (typically the user's email or provider user-id) shared by the connected accounts the token represents. A single identifier can map to one connected account per connection in the MCP configuration.",
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "examples": [
              "alice@acme.com"
            ]
          }
        }
      },
      "McpServiceCreateMcpConnectionSessionTokenBody": {
        "type": "object",
        "required": [
          "identifier"
        ],
        "properties": {
          "access_level": {
            "description": "Which tools the token can use. `READ_ONLY` limits it to the server's read-only tools; other tools are left out of `tools/list` and refused when called. `FULL`, or omitting the field, gives every tool the server serves. Case-sensitive.",
            "type": "string",
            "enum": [
              "FULL",
              "READ_ONLY"
            ],
            "examples": [
              "READ_ONLY"
            ]
          },
          "expiry": {
            "description": "Token lifetime, between 60s and 24h. Defaults to 1h.",
            "type": "string",
            "examples": [
              "3600s"
            ]
          },
          "identifier": {
            "description": "Your app's ID for the user, the same value you used when the user connected.",
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "examples": [
              "user_123"
            ]
          }
        }
      },
      "McpServiceListMcpConnectedAccountsBody": {
        "type": "object",
        "required": [
          "identifier"
        ],
        "properties": {
          "identifier": {
            "description": "Identifier for the end user whose connected accounts to retrieve",
            "type": "string",
            "examples": [
              "john.doe@example.com"
            ]
          },
          "include_auth_link": {
            "description": "When true, generates a fresh authorization link for each connection and creates connected accounts if they do not exist. When false or omitted, returns existing connected account status without creating accounts or generating links.",
            "type": "boolean"
          }
        }
      },
      "McpServiceUpdateMcpConfigBody": {
        "type": "object",
        "properties": {
          "connection_tool_mappings": {
            "description": "Updated list of connection-to-tool mappings for this MCP config. Maximum 25 connections in `DIRECT` mode.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/mcpMcpConfigConnectionToolMapping"
            }
          },
          "tool_exposure": {
            "description": "Change how the server exposes tools to agents: `DIRECT` or `META`. Leave it out to keep the current mode. Switching to `DIRECT` fails when the server has more than 25 connections. After a switch, MCP clients must list the tools again; session tokens keep working.",
            "$ref": "#/components/schemas/mcpToolExposure",
            "examples": [
              "META"
            ]
          },
          "description": {
            "description": "Updated description for the MCP configuration",
            "type": "string",
            "examples": [
              "Updated daily summarizer config"
            ]
          }
        }
      },
      "connected_accountsAuthorizationDetails": {
        "type": "object",
        "title": "Authentication credentials container supporting multiple auth types",
        "properties": {
          "google_dwd": {
            "title": "Google Domain-Wide Delegation credentials",
            "$ref": "#/components/schemas/connected_accountsGoogleDWDAuth"
          },
          "oauth_token": {
            "title": "OAuth 2.0 credentials",
            "$ref": "#/components/schemas/connected_accountsOauthToken"
          },
          "static_auth": {
            "title": "Static authentication credentials",
            "$ref": "#/components/schemas/connected_accountsStaticAuth"
          },
          "trusted_idp": {
            "title": "Trusted IDP federated credentials (e.g. AWS STS temporary credentials)",
            "$ref": "#/components/schemas/connected_accountsTrustedIDPAuth"
          }
        }
      },
      "connected_accountsConnectedAccount": {
        "type": "object",
        "properties": {
          "api_config": {
            "description": "Optional JSON configuration for connector-specific API settings such as rate limits, custom endpoints, or feature flags.",
            "type": "object",
            "examples": [
              {
                "base_url": "https://api.custom-domain.com",
                "rate_limit": 1000,
                "timeout": 30
              }
            ]
          },
          "authorization_details": {
            "description": "The account's credentials. Set the one that matches the connection's auth type - `oauth_token`, `static_auth`, `google_dwd` or `trusted_idp`.",
            "$ref": "#/components/schemas/connected_accountsAuthorizationDetails"
          },
          "authorization_type": {
            "description": "Type of authorization mechanism used. Specifies whether this connection uses OAuth, API keys, bearer tokens, or other auth methods.",
            "$ref": "#/components/schemas/connected_accountsConnectorType"
          },
          "connection_id": {
            "description": "Reference to the parent connection configuration. Links this account to a specific connector setup in your environment.",
            "type": "string",
            "examples": [
              "conn_24834495392086178"
            ]
          },
          "connector": {
            "description": "Connector identifier (e.g., 'notion', 'slack', 'salesforce'). Indicates which third-party application this account connects to.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "id": {
            "description": "Unique Scalekit-generated identifier for this connected account. Always prefixed with 'ca_'.",
            "type": "string",
            "examples": [
              "ca_24834495392086178"
            ]
          },
          "identifier": {
            "description": "The unique identifier for this account in the third-party service. Typically an email address, user ID, or workspace identifier.",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "is_org_wide_credential": {
            "description": "Whether this is the shared credential of an org-wide connection, which every user's tool calls on that connection use. `false` for a user's own account.",
            "type": "boolean"
          },
          "last_used_at": {
            "description": "Timestamp when this connected account was last used to make an API call. Useful for tracking active connections.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-03-20T14:30:00Z"
            ]
          },
          "provider": {
            "description": "The app the account connects to, such as `GMAIL` or `SLACK`.",
            "type": "string",
            "examples": [
              "GMAIL"
            ]
          },
          "status": {
            "description": "Current status of the connected account. Indicates if the account is active, expired, pending authorization, or pending user identity verification.",
            "$ref": "#/components/schemas/connected_accountsConnectorStatus"
          },
          "token_expires_at": {
            "description": "Expiration timestamp for the access token. After this time, the token must be refreshed or re-authorized.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-12-31T23:59:59Z"
            ]
          },
          "updated_at": {
            "description": "Timestamp when this connected account was last modified. Updated whenever credentials or configuration changes.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-03-20T15:04:05Z"
            ]
          }
        }
      },
      "connected_accountsConnectedAccountForList": {
        "type": "object",
        "title": "Connected account summary for list operations - excludes sensitive authorization details",
        "properties": {
          "authorization_type": {
            "description": "Authorization mechanism type.",
            "$ref": "#/components/schemas/connected_accountsConnectorType"
          },
          "connection_id": {
            "description": "Parent connection configuration reference.",
            "type": "string",
            "examples": [
              "conn_24834495392086178"
            ]
          },
          "connector": {
            "description": "Connector identifier.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "id": {
            "description": "Unique connected account identifier.",
            "type": "string",
            "examples": [
              "ca_24834495392086178"
            ]
          },
          "identifier": {
            "description": "The unique identifier for this account in the third-party service.",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "is_org_wide_credential": {
            "description": "Whether this is the shared credential of an org-wide connection, which every user's tool calls on that connection use. `false` for a user's own account.",
            "type": "boolean"
          },
          "last_used_at": {
            "description": "Last usage timestamp.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-03-20T14:30:00Z"
            ]
          },
          "provider": {
            "description": "The app the account connects to, such as `GMAIL` or `SLACK`.",
            "type": "string",
            "examples": [
              "GMAIL"
            ]
          },
          "status": {
            "description": "Current connection status.",
            "$ref": "#/components/schemas/connected_accountsConnectorStatus"
          },
          "token_expires_at": {
            "description": "Token expiration timestamp.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-12-31T23:59:59Z"
            ]
          },
          "updated_at": {
            "description": "Last modification timestamp.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-03-20T15:04:05Z"
            ]
          }
        }
      },
      "connected_accountsConnectorStatus": {
        "description": "- ACTIVE: Account is connected and credentials are valid\n - EXPIRED: Access token has expired and needs refresh\n - PENDING_AUTH: Account awaiting user authorization (re-auth initiated)\n - PENDING_VERIFICATION: OAuth complete; awaiting user identity verification\nbefore activation\n - DISCONNECTED: Account has been manually disconnected",
        "type": "string",
        "title": "Status of a connected account indicating its current state",
        "enum": [
          "ACTIVE",
          "EXPIRED",
          "PENDING_AUTH",
          "PENDING_VERIFICATION",
          "DISCONNECTED"
        ]
      },
      "connected_accountsConnectorType": {
        "description": "- OAUTH: OAuth 2.0 authorization with access and refresh tokens\n - API_KEY: Static API key authentication\n - BASIC_AUTH: HTTP Basic Authentication (username/password)\n - BEARER_TOKEN: Bearer token authentication\n - CUSTOM: Custom authentication mechanism\n - BASIC: Basic authentication (alias)\n - OAUTH_M2M: OAuth 2.0 client credentials (machine-to-machine)\n - TRELLO_OAUTH1: Trello token-based OAuth1-style browser authorization\n - GOOGLE_DWD: Google Domain-Wide Delegation\n - TRUSTED_IDP: Trusted Identity Provider federation (e.g. AWS STS AssumeRoleWithWebIdentity)\n - SMART_FHIR: SMART on FHIR (SMART App Launch) — OAuth 2.0 authorization\nfor FHIR servers\n - NO_AUTH: No authentication — connector requires no credentials (e.g. public docs MCP servers)",
        "type": "string",
        "title": "Type of authentication mechanism used for the connected account",
        "enum": [
          "OAUTH",
          "API_KEY",
          "BASIC_AUTH",
          "BEARER_TOKEN",
          "CUSTOM",
          "BASIC",
          "OAUTH_M2M",
          "TRELLO_OAUTH1",
          "GOOGLE_DWD",
          "TRUSTED_IDP",
          "SMART_FHIR",
          "NO_AUTH"
        ]
      },
      "connected_accountsCreateConnectedAccountRequest": {
        "type": "object",
        "properties": {
          "connected_account": {
            "description": "Details of the connected account to create",
            "$ref": "#/components/schemas/v1connected_accountsCreateConnectedAccount",
            "examples": [
              {
                "authorization_details": {
                  "oauth_token": {
                    "access_token": "...",
                    "refresh_token": "...",
                    "scopes": [
                      "read",
                      "write"
                    ]
                  }
                },
                "authorization_type": "OAUTH2"
              }
            ]
          },
          "connector": {
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "identifier": {
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "organization_id": {
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "org_121312434123312"
            ]
          },
          "user_id": {
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "user_121312434123312"
            ]
          }
        }
      },
      "connected_accountsCreateConnectedAccountResponse": {
        "type": "object",
        "properties": {
          "connected_account": {
            "description": "The newly created connected account with its unique identifier, status, and complete authorization details including access tokens.",
            "$ref": "#/components/schemas/connected_accountsConnectedAccount"
          }
        }
      },
      "connected_accountsDeleteConnectedAccountRequest": {
        "type": "object",
        "properties": {
          "connector": {
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "id": {
            "description": "Unique identifier for the connected account to delete",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "identifier": {
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "organization_id": {
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "org_121312434123312"
            ]
          },
          "user_id": {
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "user_121312434123312"
            ]
          }
        }
      },
      "connected_accountsGetConnectedAccountByIdentifierResponse": {
        "type": "object",
        "properties": {
          "connected_account": {
            "description": "The connected account.",
            "$ref": "#/components/schemas/connected_accountsConnectedAccount"
          }
        }
      },
      "connected_accountsGetMagicLinkForConnectedAccountRequest": {
        "type": "object",
        "properties": {
          "connector": {
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "id": {
            "description": "Unique identifier for the connected account",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "identifier": {
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "organization_id": {
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "org_121312434123312"
            ]
          },
          "state": {
            "description": "Optional opaque state value. State added to the user verify redirect URL query params to validate the user verification",
            "type": "string",
            "examples": [
              "QVNDSUFyY2hhYml0dGVyXzE2ODQ5NzIwNzI0NTY="
            ]
          },
          "user_id": {
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "user_121312434123312"
            ]
          },
          "user_verify_url": {
            "description": "Your app's URL that Scalekit sends the user to after they approve access, to confirm they are the user your app meant. Required when the environment verifies users with a custom verifier.",
            "type": "string",
            "examples": [
              "https://app.yourapp.com/user/verify/callback"
            ]
          }
        }
      },
      "connected_accountsGetMagicLinkForConnectedAccountResponse": {
        "type": "object",
        "properties": {
          "expiry": {
            "description": "Expiry timestamp for the authentication link",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2024-03-20T15:04:05Z"
            ]
          },
          "link": {
            "description": "The one-time link to send the user to. It opens the app's consent screen, or a form for their credentials.",
            "type": "string",
            "examples": [
              "https://notion.com/oauth/authorize?client_id=..."
            ]
          }
        }
      },
      "connected_accountsGoogleDWDAuth": {
        "description": "Google Domain-Wide Delegation authentication — used for GOOGLE_DWD connections.\nSend only subject in requests; access_token, scopes, and token_expires_at are response-only.",
        "type": "object",
        "properties": {
          "access_token": {
            "description": "OAuth access token acquired via the jwt-bearer grant. Present in responses only.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "ya29.a0AfH6SMBx..."
            ]
          },
          "scopes": {
            "description": "OAuth scopes granted to this token. Present in responses only.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true,
            "examples": [
              [
                "openid",
                "https://www.googleapis.com/auth/userinfo.email"
              ]
            ]
          },
          "subject": {
            "description": "Email address of the Google Workspace user to impersonate via Domain-Wide Delegation.",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "token_expires_at": {
            "description": "When the access token expires. Present in responses only.",
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        }
      },
      "connected_accountsListConnectedAccountsResponse": {
        "type": "object",
        "properties": {
          "connected_accounts": {
            "description": "List of connected accounts matching the filter criteria. Excludes sensitive authorization details for security.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/connected_accountsConnectedAccountForList"
            }
          },
          "next_page_token": {
            "description": "Pagination token for retrieving the next page. Empty if this is the last page. Pass this value to page_token in the next request.",
            "type": "string",
            "examples": [
              "eyJvZmZzZXQiOjIwfQ=="
            ]
          },
          "prev_page_token": {
            "description": "Pagination token for retrieving the previous page. Empty if this is the first page. Pass this value to page_token to go back.",
            "type": "string",
            "examples": [
              "eyJvZmZzZXQiOjB9"
            ]
          },
          "total_size": {
            "description": "Total count of connected accounts matching the filter criteria across all pages. Use for calculating pagination.",
            "type": "integer",
            "format": "int64",
            "examples": [
              100
            ]
          }
        }
      },
      "connected_accountsOauthToken": {
        "type": "object",
        "title": "OAuth 2.0 access and refresh tokens with scopes",
        "properties": {
          "access_token": {
            "description": "OAuth access token for API requests. Typically short-lived and must be refreshed after expiration.",
            "type": "string",
            "examples": [
              "ya29.a0AfH6SMBx..."
            ]
          },
          "domain": {
            "description": "Associated domain for workspace or organization-scoped OAuth connections (e.g., Google Workspace domain).",
            "type": "string",
            "examples": [
              "example.com"
            ]
          },
          "refresh_token": {
            "description": "OAuth refresh token for obtaining new access tokens. Long-lived and used to maintain persistent authorization.",
            "type": "string",
            "examples": [
              "1//0gHJxZ-Lb2..."
            ]
          },
          "scopes": {
            "description": "List of granted OAuth scopes defining the permissions and access levels for this connection.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "https://www.googleapis.com/auth/drive.readonly",
                "https://www.googleapis.com/auth/userinfo.email"
              ]
            ]
          }
        }
      },
      "connected_accountsSearchConnectedAccountsResponse": {
        "type": "object",
        "properties": {
          "connected_accounts": {
            "description": "List of connected accounts matching the search query. Excludes sensitive authorization details.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/connected_accountsConnectedAccountForList"
            }
          },
          "next_page_token": {
            "description": "Pagination token for the next page. Empty if this is the last page.",
            "type": "string",
            "examples": [
              "eyJvZmZzZXQiOjMwfQ=="
            ]
          },
          "prev_page_token": {
            "description": "Pagination token for the previous page. Empty if this is the first page.",
            "type": "string",
            "examples": [
              "eyJvZmZzZXQiOjB9"
            ]
          },
          "total_size": {
            "description": "Total count of accounts matching the search query across all pages.",
            "type": "integer",
            "format": "int64",
            "examples": [
              100
            ]
          }
        }
      },
      "connected_accountsStaticAuth": {
        "type": "object",
        "title": "Static authentication credentials for API keys, bearer tokens, or basic auth",
        "properties": {
          "details": {
            "description": "Flexible JSON structure containing static credentials. Format varies by connector type (API key, username/password, etc.).",
            "type": "object",
            "examples": [
              {
                "api_key": "sk_live_...",
                "api_secret": "..."
              }
            ]
          }
        }
      },
      "connected_accountsTrustedIDPAuth": {
        "description": "Credentials for a connection that signs in through a trusted identity provider, such as AWS Redshift. Send only `db_user`. Responses include `access_key_id` and `expiry`, never the secret key or session token.",
        "type": "object",
        "properties": {
          "access_key_id": {
            "description": "Federated access key ID issued by the trusted identity provider. Present in responses only.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "ASIA..."
            ]
          },
          "db_user": {
            "description": "Target database user for the federated session (required for provisioned Redshift clusters; ignored for serverless workgroups).",
            "type": "string",
            "examples": [
              "analytics_reader"
            ]
          },
          "expiry": {
            "description": "When the federated credentials expire. Present in responses only.",
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "secret_access_key": {
            "description": "Federated secret access key. Never returned in public API responses.",
            "type": "string",
            "readOnly": true
          },
          "session_token": {
            "description": "Federated session token. Never returned in public API responses.",
            "type": "string",
            "readOnly": true
          }
        }
      },
      "connected_accountsUpdateConnectedAccountRequest": {
        "type": "object",
        "properties": {
          "connected_account": {
            "description": "Details of the connected account to update",
            "$ref": "#/components/schemas/v1connected_accountsUpdateConnectedAccount",
            "examples": [
              {
                "authorization_details": {
                  "oauth_token": {
                    "access_token": "...",
                    "refresh_token": "...",
                    "scopes": [
                      "read",
                      "write"
                    ]
                  }
                },
                "authorization_type": "OAUTH2"
              }
            ]
          },
          "connector": {
            "description": "Connector identifier (e.g., 'notion', 'slack', 'google'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed.",
            "type": "string",
            "examples": [
              "notion"
            ]
          },
          "id": {
            "description": "Unique identifier for the connected account to update",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "identifier": {
            "description": "The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier).",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "organization_id": {
            "description": "An organization ID to key the account by instead of `identifier`, such as a Scalekit organization ID. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "org_121312434123312"
            ]
          },
          "user_id": {
            "description": "A user ID that, with `organization_id`, keys the account to one user in that organization. Ignored when `identifier` is set.",
            "type": "string",
            "examples": [
              "user_121312434123312"
            ]
          }
        }
      },
      "connected_accountsUpdateConnectedAccountResponse": {
        "type": "object",
        "properties": {
          "connected_account": {
            "description": "The updated connected account with refreshed credentials, new token expiry, and modified configuration settings.",
            "$ref": "#/components/schemas/connected_accountsConnectedAccount"
          }
        }
      },
      "connected_accountsVerifyConnectedAccountUserRequest": {
        "type": "object",
        "required": [
          "auth_request_id",
          "identifier"
        ],
        "properties": {
          "auth_request_id": {
            "description": "Auth request ID as base64url-encoded opaque token from the user verify redirect URL query params",
            "type": "string",
            "examples": [
              "QVNDSUFyY2hhYml0dGVyXzE2ODQ5NzIwNzI0NTY="
            ]
          },
          "identifier": {
            "description": "Current logged in user's connected account identifier",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          }
        }
      },
      "connected_accountsVerifyConnectedAccountUserResponse": {
        "type": "object",
        "properties": {
          "post_user_verify_redirect_url": {
            "description": "URL to redirect the user to after successful verification",
            "type": "string",
            "examples": [
              "https://env1.example.com/connect/success"
            ]
          }
        }
      },
      "connectionsAppConnection": {
        "description": "A connection: your environment's settings for one connector.",
        "type": "object",
        "properties": {
          "auth_mode": {
            "description": "`USER`: each user authorizes their own account. `ORG_WIDE`: one admin-authorized account is shared.",
            "$ref": "#/components/schemas/connectionsConnectionAuthMode",
            "examples": [
              "USER"
            ]
          },
          "connection_mcp_url": {
            "description": "The URL of an MCP server that Scalekit hosts for this connection alone. Empty when the connection has none.",
            "type": "string",
            "examples": [
              "https://yourapp.scalekit.dev/mcp/v3/connections/gmail-work"
            ]
          },
          "connection_name": {
            "description": "The connection's name, such as `gmail-work`. Your code passes this name as `connection_name` when it creates connected accounts and runs tools.",
            "type": "string",
            "examples": [
              "gmail-work"
            ]
          },
          "create_time": {
            "description": "When the connection was created.",
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "examples": [
              "2023-01-15T14:30:00Z"
            ]
          },
          "google_dwd_config": {
            "description": "Google domain-wide delegation settings. Present only for `GOOGLE_DWD` connections.",
            "$ref": "#/components/schemas/connectionsGoogleDWDConfig"
          },
          "id": {
            "description": "The connection's ID.",
            "type": "string",
            "examples": [
              "conn_2123312131125533"
            ]
          },
          "oauth_config": {
            "description": "OAuth settings. Present for connections that use OAuth.",
            "$ref": "#/components/schemas/connectionsAppOAuthConfig"
          },
          "provider": {
            "description": "The connector this connection uses, such as `GMAIL`.",
            "type": "string",
            "examples": [
              "GMAIL"
            ]
          },
          "provider_configurations": {
            "description": "Settings for connectors that need extra ones, such as Slack.",
            "$ref": "#/components/schemas/connectionsAppProviderConfigurations"
          },
          "type": {
            "description": "How users authenticate to the app, such as `OAUTH`. It comes from the connector and decides which settings object applies (`oauth_config` or `google_dwd_config`).",
            "$ref": "#/components/schemas/connectionsConnectionType",
            "examples": [
              "OAUTH"
            ]
          },
          "update_time": {
            "description": "When the connection was last changed.",
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "examples": [
              "2023-02-20T09:15:30Z"
            ]
          }
        }
      },
      "connectionsAppConnectionSummary": {
        "description": "A connection in a list, without its settings.",
        "type": "object",
        "properties": {
          "auth_mode": {
            "description": "`USER`: each user authorizes their own account. `ORG_WIDE`: one admin-authorized account is shared.",
            "$ref": "#/components/schemas/connectionsConnectionAuthMode"
          },
          "connection_name": {
            "description": "The connection's name.",
            "type": "string"
          },
          "create_time": {
            "description": "When the connection was created.",
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "description": "The connection's ID.",
            "type": "string",
            "examples": [
              "conn_2123312131125533"
            ]
          },
          "provider": {
            "description": "The connector this connection uses, such as `GMAIL`.",
            "type": "string"
          },
          "type": {
            "description": "How users authenticate to the app, such as `OAUTH`.",
            "$ref": "#/components/schemas/connectionsConnectionType"
          }
        }
      },
      "connectionsAppConnectionUpdate": {
        "description": "The settings to change. Send only what you want to change.",
        "type": "object",
        "properties": {
          "connection_name": {
            "description": "A new name for the connection, such as `gmail-prod`: letters, numbers and hyphens, unique in the environment. Your code refers to the connection by this name, so update the `connection_name` it passes when you rename one.",
            "type": "string",
            "examples": [
              "gmail-prod"
            ]
          },
          "google_dwd_config": {
            "description": "Google domain-wide delegation settings to change. Only for connections whose `type` is `GOOGLE_DWD`.",
            "$ref": "#/components/schemas/connectionsGoogleDWDConfig"
          },
          "oauth_config": {
            "description": "OAuth settings to change, such as `client_id`, `client_secret` and `scopes`. For connections that use OAuth, such as `type` `OAUTH`.",
            "$ref": "#/components/schemas/connectionsAppOAuthConfig"
          },
          "provider_configurations": {
            "description": "Connector-specific settings to change, for the connectors listed on each field. `provider_domain` can only be set when you create the connection.",
            "$ref": "#/components/schemas/connectionsAppProviderConfigurations"
          }
        }
      },
      "connectionsAppOAuthConfig": {
        "description": "OAuth settings for the connection.",
        "type": "object",
        "properties": {
          "access_type": {
            "description": "The `access_type` value sent to the provider, such as `offline`.",
            "type": "string",
            "examples": [
              "offline"
            ]
          },
          "authorize_uri": {
            "description": "The provider's authorization URL.",
            "type": "string",
            "examples": [
              "https://youridp.com/service/oauth/authorize"
            ]
          },
          "client_id": {
            "description": "The client ID of the OAuth app you registered with the provider, such as `123456789012-abc123def456.apps.googleusercontent.com` for a Google app. Get it from the provider's developer console when you create the app (for Gmail: Google Cloud console, **APIs & Services** > **Credentials**, an OAuth client ID of type web application), and add this connection's `redirect_uri` to the app as an authorized redirect URI. Each connector's page under [Connectors](/agentkit/connectors/) has the steps for that provider.",
            "type": "string",
            "examples": [
              "123456789012-abc123def456.apps.googleusercontent.com"
            ]
          },
          "client_secret": {
            "description": "The client secret of the same OAuth app, from the provider's developer console. Write-only: responses show it masked, such as `********abcd`. Leave it out to keep the stored secret.",
            "type": "string",
            "examples": [
              "GOCSPX-your-client-secret"
            ]
          },
          "extra_authorize_params": {
            "description": "Extra query parameters to add to the provider's authorization URL, as name-value pairs, such as `{\"hd\": \"example.com\"}`, which asks Google to suggest accounts from that domain. Check the provider's OAuth documentation for the parameters it accepts. Send `{}` to clear them.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "hd": "example.com"
              }
            ]
          },
          "optional_scopes": {
            "description": "A second set of scopes, for providers that take them in a separate authorization parameter, such as Slack's `user_scope`. Set `field_name` to that parameter's name and `scopes` to its values.",
            "$ref": "#/components/schemas/connectionsOptionalScopes"
          },
          "pkce_enabled": {
            "description": "Whether Scalekit adds PKCE to the authorization request. Turn it on when the provider requires or supports PKCE.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "prompt": {
            "description": "The `prompt` value sent to the provider, which controls whether the user signs in or consents again, such as `consent`. Send an empty string to send no `prompt`.",
            "type": "string",
            "examples": [
              "consent"
            ]
          },
          "redirect_uri": {
            "description": "The redirect URI to add to the app you registered with the provider, as an authorized redirect URI. Scalekit sets it; you can't change it.",
            "type": "string",
            "examples": [
              "https://yourapp.scalekit.dev/sso/v1/oauth/conn_24832952112323587/callback"
            ]
          },
          "required_optional_scopes": {
            "description": "Scopes from `optional_scopes.scopes` that users can't deselect when `scope_selection_allowed` is `true`. Each must also be in `optional_scopes.scopes`.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "search:read"
              ]
            ]
          },
          "required_scopes": {
            "description": "Scopes from `scopes` that users can't deselect when `scope_selection_allowed` is `true`, such as the read scope your tools always need. Each must also be in `scopes`, or the request fails with `400`.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "https://www.googleapis.com/auth/gmail.readonly"
              ]
            ]
          },
          "scope_selection_allowed": {
            "description": "Set to `true` to let users choose which of the `scopes` to grant when they connect. Scopes in `required_scopes` stay selected.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "scopes": {
            "description": "The OAuth scopes users grant when they connect, such as `https://www.googleapis.com/auth/gmail.readonly` for Gmail. A list you send replaces the whole current list, so include the scopes you want to keep. To build it, start from the current scopes in [Get a connection](/agentkit/reference/connections/get-a-connection/), then pick from the scopes the connector offers: call [List connectors](/agentkit/bring-your-own-connector/create-connector/#list-connectors) with `identifier` set to the connector, such as `GMAIL`, and read `auth_patterns[].oauth_config.available_scopes[].scope`. You can also add a scope that isn't listed there, using the exact scope string from the provider's own documentation, such as Google's [Gmail API scopes](https://developers.google.com/workspace/gmail/api/auth/scopes).",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "https://www.googleapis.com/auth/gmail.readonly",
                "https://www.googleapis.com/auth/gmail.send"
              ]
            ]
          },
          "token_access_type": {
            "description": "The `token_access_type` value sent to the provider, for providers that use it, such as Dropbox with `offline`.",
            "type": "string",
            "examples": [
              "offline"
            ]
          },
          "token_endpoint_auth_method": {
            "description": "How Scalekit sends client credentials to the provider's token URL. `DEFAULT` lets Scalekit choose.",
            "$ref": "#/components/schemas/AppOAuthConfigTokenEndpointAuthMethod",
            "examples": [
              "BASIC_AUTH"
            ]
          },
          "token_uri": {
            "description": "The provider's token URL.",
            "type": "string",
            "examples": [
              "https://youridp.com/service/oauth/token"
            ]
          },
          "use_scalekit_creds": {
            "description": "Set to `true` to use Scalekit's own OAuth app instead of yours, for connectors that offer one; otherwise the request fails with `400`. Sending your own `client_id` or `client_secret` sets it to `false` unless you also send it.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "user_info_uri": {
            "description": "The provider's user info URL.",
            "type": "string",
            "examples": [
              "https://youridp.com/service/oauth/userinfo"
            ]
          }
        }
      },
      "connectionsAppProviderConfigurations": {
        "description": "Settings for connectors that need extra ones.",
        "type": "object",
        "properties": {
          "googleads_developer_token": {
            "description": "Google Ads only: your Google Ads API developer token. See Google's [Obtain a developer token](https://developers.google.com/google-ads/api/docs/get-started/dev-token). Responses show it masked.",
            "type": "string",
            "examples": [
              "ABcDeFgHiJkLmNoPqRsTuV"
            ]
          },
          "microsoft_tenant_id": {
            "description": "Microsoft connectors only: the ID of your Microsoft Entra tenant, from the **Overview** page of Microsoft Entra ID in the Azure portal.",
            "type": "string",
            "examples": [
              "72f988bf-86f1-41af-91ab-2d7cd011db47"
            ]
          },
          "provider_domain": {
            "description": "The regional domain that hosts your account, such as `mcp-eu.mixpanel.com` for Mixpanel's EU region, for connectors that need one. Set it when you create the connection; it can't be changed later and isn't returned.",
            "type": "string",
            "examples": [
              "mcp-eu.mixpanel.com"
            ]
          },
          "slack_connection_type": {
            "description": "Slack only: `BOT` to act as your Slack app's bot user, or `USER` to act as the user who connects.",
            "type": "string",
            "enum": [
              "BOT",
              "USER"
            ],
            "examples": [
              "USER"
            ]
          },
          "smart_fhir_aud": {
            "description": "SMART on FHIR only: the base URL of the FHIR server, sent as the `aud` parameter when users sign in.",
            "type": "string",
            "examples": [
              "https://fhir.example.com/r4"
            ]
          },
          "smart_fhir_domain": {
            "description": "SMART on FHIR only: the domain of the FHIR server.",
            "type": "string",
            "examples": [
              "fhir.example.com"
            ]
          },
          "trello_app_name": {
            "description": "Trello only: the name of your Trello app, which Trello shows users when they authorize it.",
            "type": "string",
            "examples": [
              "My Trello App"
            ]
          }
        }
      },
      "connectionsConnectionAuthMode": {
        "description": "How users authorize the connection: `USER` or `ORG_WIDE`.",
        "type": "string",
        "enum": [
          "USER",
          "ORG_WIDE"
        ]
      },
      "connectionsCreateAppConnectionResponse": {
        "description": "The connection that was created.",
        "type": "object",
        "properties": {
          "connection": {
            "$ref": "#/components/schemas/connectionsAppConnection",
            "description": "The connection that was created."
          }
        }
      },
      "connectionsGetAppConnectionResponse": {
        "type": "object",
        "properties": {
          "connection": {
            "$ref": "#/components/schemas/connectionsAppConnection",
            "description": "The connection."
          }
        },
        "description": "The connection."
      },
      "connectionsListAppConnectionSummariesResponse": {
        "type": "object",
        "properties": {
          "connections": {
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/connectionsAppConnectionSummary"
            },
            "description": "The connections on this page, newest first."
          },
          "next_page_token": {
            "type": "string",
            "description": "Pass as `page_token` to get the next page. Empty on the last page."
          },
          "prev_page_token": {
            "type": "string",
            "description": "Pass as `page_token` to get the previous page."
          },
          "total_size": {
            "description": "The number of connections that match.",
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "connectionsUpdateAppConnectionResponse": {
        "type": "object",
        "properties": {
          "connection": {
            "$ref": "#/components/schemas/connectionsAppConnection",
            "description": "The connection with its new settings."
          }
        },
        "description": "The connection with its new settings."
      },
      "v1connectionsCreateAppConnection": {
        "type": "object",
        "properties": {
          "auth_mode": {
            "description": "`USER` (default): each user authorizes their own account. `ORG_WIDE`: one admin authorizes an account that every user shares. You can't change it after the connection is created.",
            "$ref": "#/components/schemas/connectionsConnectionAuthMode",
            "examples": [
              "USER"
            ]
          },
          "connection_name": {
            "description": "A name for the connection, such as `gmail-work`: letters, numbers and hyphens, unique in the environment. Your code passes this name as `connection_name` when it creates connected accounts and runs tools. Scalekit generates one if you leave it out.",
            "type": "string",
            "examples": [
              "gmail-work"
            ]
          },
          "provider": {
            "description": "The connector's identifier, such as `GMAIL`. To find a connector's identifier, call [List connectors](/agentkit/bring-your-own-connector/create-connector/#list-connectors) and read `identifier`.",
            "type": "string",
            "examples": [
              "GMAIL"
            ]
          },
          "provider_configurations": {
            "description": "Extra settings, only for the connectors named on each field, such as `provider_domain` for a connector with regional domains.",
            "$ref": "#/components/schemas/connectionsAppProviderConfigurations"
          }
        },
        "description": "The connection to create."
      },
      "AppOAuthConfigTokenEndpointAuthMethod": {
        "description": "How Scalekit sends client credentials to the provider's token URL.",
        "type": "string",
        "enum": [
          "NONE",
          "BASIC_AUTH",
          "REQUEST_BODY",
          "DEFAULT"
        ]
      },
      "connectionsConnectionType": {
        "type": "string",
        "enum": [
          "OIDC",
          "SAML",
          "PASSWORD",
          "OAUTH",
          "PASSWORDLESS",
          "BASIC",
          "BEARER",
          "API_KEY",
          "WEBAUTHN",
          "OAUTH_M2M",
          "TRELLO_OAUTH1",
          "GOOGLE_DWD",
          "TRUSTED_IDP",
          "SMART_FHIR",
          "NO_AUTH"
        ]
      },
      "connectionsGoogleDWDConfig": {
        "type": "object",
        "properties": {
          "required_scopes": {
            "description": "Scopes from `scopes` that users can't deselect when `scope_selection_allowed` is `true`. Each must also be in `scopes`.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "https://www.googleapis.com/auth/gmail.readonly"
              ]
            ]
          },
          "scope_selection_allowed": {
            "description": "Set to `true` to let users choose which of the `scopes` to grant when they connect.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "scopes": {
            "description": "The Google scopes to request, such as `https://www.googleapis.com/auth/gmail.readonly`. A list you send replaces the current one. Authorize the same scopes for the service account's client ID in the Google Workspace Admin console, under **Security** > **Access and data control** > **API controls** > **Manage domain wide delegation**.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "https://www.googleapis.com/auth/gmail.readonly"
              ]
            ]
          },
          "service_account_json": {
            "description": "The contents of the service account's JSON key file, as a string. Create the key in the Google Cloud console under **IAM & Admin** > **Service accounts** > your service account > **Keys** > **Add key**. Responses show it masked.",
            "type": "string",
            "examples": [
              "{\"type\":\"service_account\",\"project_id\":\"my-project\",\"private_key_id\":\"0123456789abcdef\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\nMIIEvQ...\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"dwd-sa@my-project.iam.gserviceaccount.com\",\"client_id\":\"123456789012345678901\"}"
            ]
          },
          "token_uri": {
            "description": "Google's token URL. Leave it out to use `https://oauth2.googleapis.com/token`.",
            "type": "string"
          }
        }
      },
      "connectionsOptionalScopes": {
        "type": "object",
        "properties": {
          "field_name": {
            "description": "Name of the field in which scope should be sent in the authentication request. This is required by some identity providers that expect scopes to be sent in a custom field instead of the standard 'scope' parameter.",
            "type": "string",
            "examples": [
              "optional_scope or bot_scope"
            ]
          },
          "scopes": {
            "description": "List of optional scopes that can be requested during authentication",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "scope1",
                "scope2"
              ]
            ]
          }
        }
      },
      "mcpCreateMcpConfigResponse": {
        "type": "object",
        "properties": {
          "config": {
            "description": "The created MCP configuration",
            "$ref": "#/components/schemas/mcpMcpConfig"
          }
        }
      },
      "mcpCreateMcpSessionTokenResponse": {
        "type": "object",
        "properties": {
          "expires_at": {
            "description": "Absolute time at which the token expires. Equals issued_at + expiry.",
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "token": {
            "description": "Signed JWT (RS256) whose `sub` claim is the supplied identifier and whose `aud` claim is the MCP server URL the token is scoped to: the MCP configuration's server URL for a configuration token, or the connection's `<env_url>/mcp/v3/connections/{key_id}` URL for a connection token. A configuration token also carries the MCP configuration ID (`mcp_cfg`); a connection token carries the connection ID (`conn_id`) instead. Both carry the resolved connected-account IDs (`ca_ids`). Signed with the calling environment's active JWT signing key.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "eyJhbGciOiJSUzI1NiIsImtpZCI6InNua18xMjMifQ.eyJhdWQiOlsiYWxpY2VAYWNtZS5jb20iXSwidG9rZW5fdHlwZSI6Im1jcF9zZXNzaW9uIn0.signature"
            ]
          }
        }
      },
      "mcpGetMcpConfigResponse": {
        "type": "object",
        "properties": {
          "config": {
            "description": "The requested MCP configuration",
            "$ref": "#/components/schemas/mcpMcpConfig"
          }
        }
      },
      "mcpListMcpConfigsResponse": {
        "type": "object",
        "properties": {
          "configs": {
            "description": "List of MCP configurations",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/mcpMcpConfig"
            }
          },
          "next_page_token": {
            "description": "Pagination token to fetch the next page",
            "type": "string"
          },
          "prev_page_token": {
            "description": "Pagination token to fetch the previous page",
            "type": "string"
          },
          "total_size": {
            "description": "Total number of configs matching the filter",
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "mcpListMcpConnectedAccountsResponse": {
        "type": "object",
        "properties": {
          "connected_accounts": {
            "description": "Connected account state for each connection in the configuration",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/mcpMcpConnectionAuthState"
            }
          }
        }
      },
      "mcpMcpConfig": {
        "type": "object",
        "properties": {
          "connection_tool_mappings": {
            "description": "List of connection-to-tool mappings for this MCP config. Maximum 25 connections in `DIRECT` mode.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/mcpMcpConfigConnectionToolMapping"
            }
          },
          "description": {
            "description": "Description of the MCP configuration",
            "type": "string",
            "examples": [
              "Summarizes daily emails and posts to Slack"
            ]
          },
          "id": {
            "description": "Unique ID of the MCP config",
            "type": "string",
            "readOnly": true,
            "examples": [
              "cfg_85630864460904897"
            ]
          },
          "mcp_server_url": {
            "description": "The URL MCP clients connect to for this server. Every user and session shares it; the session token identifies the user.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "https://env.scalekit.com/mcp/v3/servers/550e8400-e29b-41d4-a716-446655440000"
            ]
          },
          "tool_exposure": {
            "description": "How the server exposes tools to agents. `DIRECT` lists every tool you map to it, for up to 25 connections. `META` gives agents five tools to search for, inspect and run the mapped tools, with no limit on connections. `DIRECT` is the default when you create a server without it.",
            "$ref": "#/components/schemas/mcpToolExposure",
            "examples": [
              "DIRECT"
            ]
          },
          "name": {
            "description": "Unique name for the MCP configuration. Must be 1–100 characters. Allowed characters: lowercase letters (a–z), digits (0–9), hyphens (-), and underscores (_).",
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "examples": [
              "daily-summarizer"
            ]
          }
        }
      },
      "mcpMcpConfigConnectionToolMapping": {
        "type": "object",
        "properties": {
          "connected_account_id": {
            "description": "Connected account backing this connection in the MCP instance context",
            "type": "string",
            "readOnly": true
          },
          "connected_account_status": {
            "description": "Authentication status for the connected account",
            "type": "string",
            "readOnly": true
          },
          "connection_id": {
            "description": "Unique ID of the connection",
            "type": "string",
            "readOnly": true
          },
          "connection_name": {
            "description": "Developer-assigned connection name",
            "type": "string"
          },
          "provider": {
            "description": "Provider name for this connection",
            "type": "string",
            "readOnly": true
          },
          "tools": {
            "description": "List of tool names linked to this connection (empty = all tools)",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "mcpMcpConnectionAuthState": {
        "type": "object",
        "properties": {
          "authentication_link": {
            "description": "Fresh authorization link for the connected account. Empty when include_auth_link is false or when the connection has no associated key.",
            "type": "string"
          },
          "connected_account_id": {
            "description": "ID of the connected account for this user and connection",
            "type": "string"
          },
          "connected_account_status": {
            "description": "Authentication status of the connected account",
            "type": "string"
          },
          "connection_id": {
            "description": "ID of the connection",
            "type": "string"
          },
          "connection_name": {
            "description": "Name of the connection",
            "type": "string"
          },
          "provider": {
            "description": "Provider identifier for the connection",
            "type": "string"
          }
        }
      },
      "mcpToolExposure": {
        "type": "string",
        "description": "How a Virtual MCP server exposes tools: `DIRECT` lists every mapped tool, `META` gives agents five tools to search for and run them.",
        "enum": [
          "DIRECT",
          "META"
        ]
      },
      "mcpUpdateMcpConfigResponse": {
        "type": "object",
        "properties": {
          "config": {
            "description": "The updated MCP configuration",
            "$ref": "#/components/schemas/mcpMcpConfig"
          }
        }
      },
      "providersCreateProviderResponse": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/providersProvider"
          }
        }
      },
      "providersDeleteProviderResponse": {
        "type": "object"
      },
      "providersProvider": {
        "type": "object",
        "title": "Provider represents a connected app provider",
        "properties": {
          "auth_patterns": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "coming_soon": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "display_priority": {
            "type": "integer",
            "format": "int32"
          },
          "icon_src": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "identifier": {
            "type": "string"
          },
          "is_custom": {
            "description": "Indicates whether the provider is environment-scoped (custom provider)",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "is_custom_mcp": {
            "description": "Indicates whether this is an environment-scoped MCP-based custom provider",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "metadata": {
            "description": "Custom key-value metadata stored for this provider. Returned for all providers; defaults to {} when no metadata has been set.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "api_version": "v2",
                "region": "us-east-1"
              }
            ]
          },
          "proxy_enabled": {
            "type": "boolean"
          },
          "proxy_url": {
            "type": "string"
          }
        }
      },
      "providersUpdateProviderResponse": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/providersProvider"
          }
        }
      },
      "toolsExecuteToolRequest": {
        "type": "object",
        "properties": {
          "agent_run_id": {
            "description": "Optional. Customer-supplied identifier grouping multiple tool calls into a single agent run. Useful for correlating logs across an agentic workflow.",
            "type": "string",
            "examples": [
              "run_abc123"
            ]
          },
          "connected_account_id": {
            "description": "Optional. The unique ID of the connected account. Use this to directly identify the connected account instead of using identifier + connector combination.",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "connector": {
            "description": "Optional. The name of the connector/provider (e.g., 'Google Workspace', 'Slack', 'Notion'). Alphanumeric characters, spaces, hyphens, underscores, and colons are allowed. Use this in combination with identifier to identify the connected account.",
            "type": "string",
            "examples": [
              "Google Workspace"
            ]
          },
          "identifier": {
            "description": "Optional. The unique identifier for the connected account within the third-party service (e.g., email address, user ID, workspace identifier). Use this in combination with connector to identify the connected account.",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "organization_id": {
            "description": "Optional. The organization ID to scope the connected account lookup. Use this to narrow down the search when the same identifier exists across multiple organizations.",
            "type": "string",
            "examples": [
              "org_123"
            ]
          },
          "params": {
            "description": "JSON object containing the parameters required for tool execution. The structure depends on the specific tool being executed.",
            "type": "object",
            "examples": [
              {
                "body": "Hello World",
                "subject": "Hello",
                "to": "user@example.com"
              }
            ]
          },
          "tool_name": {
            "description": "Name of the tool to execute",
            "type": "string",
            "examples": [
              "send_email"
            ]
          },
          "user_id": {
            "description": "Optional. The user ID to scope the connected account lookup. Use this to narrow down the search when the same identifier exists across multiple users.",
            "type": "string",
            "examples": [
              "user_123"
            ]
          }
        }
      },
      "toolsExecuteToolResponse": {
        "type": "object",
        "properties": {
          "data": {
            "description": "The tool's output: the app's response, as JSON.",
            "type": "object",
            "examples": [
              {
                "body": "Hello World",
                "subject": "Hello",
                "to": "user@example.com"
              }
            ]
          },
          "execution_id": {
            "description": "Unique identifier for the tool execution",
            "type": "string",
            "examples": [
              "123456789"
            ]
          }
        }
      },
      "toolsListAvailableToolsResponse": {
        "type": "object",
        "properties": {
          "next_page_token": {
            "description": "Token for fetching the next page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjozLCJsaW1pdCI6MzB9"
            ]
          },
          "prev_page_token": {
            "description": "Token for fetching the previous page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjoxLCJsaW1pdCI6MzB9"
            ]
          },
          "tools": {
            "description": "List of tools available for the identifier",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/toolsTool"
            }
          },
          "total_size": {
            "description": "Total number of available tools matching the query",
            "type": "integer",
            "format": "int64",
            "examples": [
              104
            ]
          }
        }
      },
      "toolsListScopedToolsResponse": {
        "type": "object",
        "properties": {
          "next_page_token": {
            "description": "Token for fetching the next page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjozLCJsaW1pdCI6MzB9"
            ]
          },
          "prev_page_token": {
            "description": "Token for fetching the previous page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjoxLCJsaW1pdCI6MzB9"
            ]
          },
          "tools": {
            "description": "List of tools scoped to the given connected account identifier",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/toolsScopedTool"
            }
          },
          "total_size": {
            "description": "Total number of tools matching the query",
            "type": "integer",
            "format": "int64",
            "examples": [
              104
            ]
          }
        }
      },
      "toolsListToolsResponse": {
        "type": "object",
        "properties": {
          "next_page_token": {
            "description": "Token for fetching the next page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjozLCJsaW1pdCI6MzB9"
            ]
          },
          "prev_page_token": {
            "description": "Token for fetching the previous page of tools",
            "type": "string",
            "examples": [
              "eyJwYWdlIjoxLCJsaW1pdCI6MzB9"
            ]
          },
          "tool_names": {
            "description": "List of tool names, returned when filter.summary is true",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "gmail_send_message"
              ]
            ]
          },
          "tools": {
            "description": "List of tools, returned when filter.summary is false or omitted",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/toolsTool"
            }
          },
          "total_size": {
            "description": "Total number of tools matching the query",
            "type": "integer",
            "format": "int64",
            "examples": [
              104
            ]
          }
        }
      },
      "toolsScopedTool": {
        "type": "object",
        "properties": {
          "connected_account_id": {
            "description": "ID of the connected account for this scoped tool",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "identifier": {
            "description": "Connected account identifier this tool is scoped to",
            "type": "string"
          },
          "tool": {
            "description": "The underlying tool definition",
            "$ref": "#/components/schemas/toolsTool"
          }
        }
      },
      "toolsSearchedTool": {
        "type": "object",
        "properties": {
          "connections": {
            "description": "Connections for this tool's provider that the supplied identifier has a connected account for (any status), each with its own readiness state and connected_account_id. Populated only when identifier is supplied in the request. An empty array means this identifier does not have any connection at all for this tool's provider -- not an error, and not the same as a connection listed with TOOL_READINESS_STATE_NEEDS_CONNECTION. More than one entry means the identifier has accounts on multiple connections for this provider (e.g. two Slack workspaces) -- inspect each entry's own readiness_state before using its connected_account_id.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/toolsConnectionReadiness"
            }
          },
          "description": {
            "description": "Human-readable description of what the tool does",
            "type": "string",
            "examples": [
              "Send a message to a Slack channel or user"
            ]
          },
          "name": {
            "description": "Fully qualified tool name to pass to ExecuteTool",
            "type": "string",
            "examples": [
              "slack_send_message"
            ]
          },
          "provider": {
            "description": "Provider the tool belongs to",
            "type": "string",
            "examples": [
              "SLACK"
            ]
          },
          "score": {
            "description": "Relevance score for this result. Higher is better; comparable only within a single response.",
            "type": "number",
            "format": "double",
            "examples": [
              0.82
            ]
          }
        }
      },
      "toolsConnectionReadiness": {
        "type": "object",
        "properties": {
          "connected_account_id": {
            "description": "ID of the connected account for this connection and the supplied identifier. Always populated when this entry is present, regardless of readiness_state -- check readiness_state before using it, since only TOOL_READINESS_STATE_READY means it is safe to pass to ExecuteTool now.",
            "type": "string",
            "examples": [
              "ca_123"
            ]
          },
          "connection_name": {
            "description": "Name of this connection.",
            "type": "string",
            "examples": [
              "Acme Slack"
            ]
          },
          "readiness_state": {
            "description": "Whether this specific connection is usable right now for the supplied identifier, independent of every other connection listed for this provider.",
            "$ref": "#/components/schemas/toolsToolReadinessState",
            "examples": [
              "TOOL_READINESS_STATE_READY"
            ]
          }
        }
      },
      "toolsToolReadinessState": {
        "description": "Readiness of a connection for use with ExecuteTool.\n\n - TOOL_READINESS_STATE_READY: Usable now. Safe to pass connected_account_id to ExecuteTool.\n - TOOL_READINESS_STATE_NEEDS_CONNECTION: A connected account exists for this connection but is inactive (e.g. disconnected). The end user must re-establish the connection.\n - TOOL_READINESS_STATE_NEEDS_REAUTH: A connected account exists but its token expired. The end user must re-authenticate.",
        "type": "string",
        "enum": [
          "TOOL_READINESS_STATE_READY",
          "TOOL_READINESS_STATE_NEEDS_CONNECTION",
          "TOOL_READINESS_STATE_NEEDS_REAUTH"
        ]
      },
      "toolsSearchToolsRequest": {
        "type": "object",
        "properties": {
          "identifier": {
            "description": "Optional connected-account identifier (e.g. the end user's email or ID). When set, each result is annotated with a readiness state for this identifier's connections. When omitted, results are ranked without readiness annotation.",
            "type": "string",
            "examples": [
              "user@example.com"
            ]
          },
          "query": {
            "description": "Natural-language query or keywords describing the job to be done. Ranked against tool names, descriptions, and providers. 1-256 characters.",
            "type": "string",
            "examples": [
              "send a message to a slack channel"
            ]
          },
          "top_k": {
            "description": "Maximum number of ranked results to return. Defaults to 10, capped at 50.",
            "type": "integer",
            "format": "int64",
            "examples": [
              10
            ]
          }
        },
        "required": [
          "query"
        ]
      },
      "toolsSearchToolsResponse": {
        "type": "object",
        "properties": {
          "tools": {
            "description": "Tools matching the query, ordered by descending relevance score",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/toolsSearchedTool"
            }
          }
        }
      },
      "toolsTool": {
        "type": "object",
        "properties": {
          "definition": {
            "description": "Tool definition in structured format",
            "type": "object",
            "examples": [
              {
                "input": {
                  "type": "object"
                }
              }
            ]
          },
          "id": {
            "description": "Unique ID of the tool. Immutable and read-only.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "tol_123"
            ]
          },
          "is_default": {
            "description": "Marks this tool as the default version for the combination. Read-only.",
            "type": "boolean",
            "readOnly": true,
            "examples": [
              true
            ]
          },
          "metadata": {
            "description": "Additional metadata about the tool",
            "type": "object",
            "examples": [
              {
                "category": "email"
              }
            ]
          },
          "provider": {
            "description": "Provider name (e.g. GOOGLE). Read-only.",
            "type": "string",
            "readOnly": true,
            "examples": [
              "GOOGLE"
            ]
          },
          "tags": {
            "description": "Tags for categorization or filtering",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "notification",
                "email"
              ]
            ]
          },
          "updated_at": {
            "description": "Timestamp when the tool was last updated. Read-only.",
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "examples": [
              "2023-10-01T12:00:00Z"
            ]
          }
        }
      },
      "v1connected_accountsCreateConnectedAccount": {
        "type": "object",
        "title": "Payload for creating a new connected account - authorization details are optional",
        "properties": {
          "api_config": {
            "description": "Optional JSON configuration for connector-specific API settings such as rate limits, custom API endpoints, timeouts, or feature flags.",
            "type": "object",
            "examples": [
              {
                "base_url": "https://api.custom-domain.com",
                "rate_limit": 1000,
                "timeout": 30
              }
            ]
          },
          "authorization_details": {
            "description": "Optional authentication credentials for the connected account. Include OAuth tokens (access_token, refresh_token, scopes) or static auth details (API keys, bearer tokens). Can be provided later via update.",
            "$ref": "#/components/schemas/connected_accountsAuthorizationDetails",
            "examples": [
              {
                "oauth_token": {
                  "access_token": "ya29.a0...",
                  "refresh_token": "1//0g...",
                  "scopes": [
                    "email",
                    "profile"
                  ]
                }
              }
            ]
          }
        }
      },
      "v1connected_accountsUpdateConnectedAccount": {
        "type": "object",
        "title": "Payload for updating an existing connected account - all fields optional",
        "properties": {
          "api_config": {
            "description": "Updated JSON configuration for API-specific settings. Merges with existing configuration - only provided fields are modified.",
            "type": "object",
            "examples": [
              {
                "rate_limit": 2000,
                "timeout": 60
              }
            ]
          },
          "authorization_details": {
            "description": "Updated authentication credentials. Provide new OAuth tokens (e.g., after refresh) or updated static auth details. Only included fields will be modified.",
            "$ref": "#/components/schemas/connected_accountsAuthorizationDetails",
            "examples": [
              {
                "oauth_token": {
                  "access_token": "ya29.new_token...",
                  "refresh_token": "1//0g...",
                  "scopes": [
                    "email",
                    "profile",
                    "calendar"
                  ]
                }
              }
            ]
          }
        }
      },
      "v1providersCreateCustomProvider": {
        "type": "object",
        "properties": {
          "auth_patterns": {
            "description": "Authentication patterns for the connected app provider",
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "description": {
            "description": "Description of the connected app provider",
            "type": "string",
            "examples": [
              "Connect to Google Workspace for email and calendar integration"
            ]
          },
          "display_name": {
            "description": "Display name for the connected app provider",
            "type": "string",
            "examples": [
              "Google Workspace"
            ]
          },
          "icon_src": {
            "description": "URL for the provider icon. Should be an SVG image sized 800x800 pixels for best rendering experience.",
            "type": "string",
            "examples": [
              "https://example.com/images/my-connector.svg"
            ]
          },
          "metadata": {
            "description": "Custom key-value metadata for this provider. Keys must be 3-25 characters, values must be 1-256 characters, with a maximum of 20 key-value pairs.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "api_version": "v2",
                "region": "us-east-1"
              }
            ]
          },
          "proxy_enabled": {
            "description": "This flag indicates whether proxying is turned on for the connected app provider. When enabled, requests are routed through the provider proxy instead of being sent directly.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "proxy_url": {
            "description": "Proxy URL for the connected app provider. Must start with https://",
            "type": "string",
            "examples": [
              "https://mcp.example.com/mcp"
            ]
          }
        }
      },
      "v1providersUpdateCustomProvider": {
        "type": "object",
        "properties": {
          "auth_patterns": {
            "description": "Authentication patterns for the connected app provider",
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "description": {
            "description": "Description of the connected app provider",
            "type": "string",
            "examples": [
              "Connect to Google Workspace for email and calendar integration"
            ]
          },
          "display_name": {
            "description": "Display name for the connected app provider",
            "type": "string",
            "examples": [
              "Google Workspace"
            ]
          },
          "icon_src": {
            "description": "URL for the provider icon. Should be an SVG image sized 800x800 pixels for best rendering experience.",
            "type": "string",
            "examples": [
              "https://example.com/images/my-connector.svg"
            ]
          },
          "metadata": {
            "description": "Custom key-value metadata for this provider. Keys must be 3-25 characters, values must be 1-256 characters, with a maximum of 20 key-value pairs.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "api_version": "v2",
                "region": "us-east-1"
              }
            ]
          },
          "proxy_enabled": {
            "description": "This flag indicates whether proxying is turned on for the connected app provider. When enabled, requests are routed through the provider proxy instead of being sent directly.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "proxy_url": {
            "description": "Proxy URL for the connected app provider. Must start with https://",
            "type": "string",
            "examples": [
              "https://mcp.example.com/mcp"
            ]
          }
        }
      },
      "ConnectedAccountStatusUpdatedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.status_updated webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "example": "evt_101652975398683158",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")",
            "minLength": 1,
            "maxLength": 32
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.status_updated"
            ],
            "example": "connected_account.status_updated"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)",
            "example": "2025-12-02T06:31:34.895815554Z"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "example": "env_88640229614813449",
            "description": "The environment ID where the event occurred",
            "minLength": 1,
            "maxLength": 32
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountStatusUpdatedEventData"
          }
        }
      },
      "ConnectedAccountStatusUpdatedEventData": {
        "type": "object",
        "description": "The connected account whose status changed, including its previous status.",
        "required": [
          "id",
          "identifier",
          "connection_id",
          "provider",
          "authorization_type",
          "status",
          "old_status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ca_",
            "example": "ca_133400349586228019",
            "description": "Unique identifier of the connected account (prefixed with \"ca_\")"
          },
          "identifier": {
            "type": "string",
            "example": "user_123",
            "description": "The end-user identifier the connected account belongs to"
          },
          "connection_id": {
            "type": "string",
            "pattern": "^conn_",
            "example": "conn_133400101014995480",
            "description": "Identifier of the connection (prefixed with \"conn_\")"
          },
          "connection_name": {
            "type": "string",
            "example": "gmail",
            "description": "The connection's name, as shown in AgentKit > Connections. Omitted when it cannot be resolved."
          },
          "provider": {
            "type": "string",
            "example": "GMAIL",
            "description": "The provider of the connected account"
          },
          "authorization_type": {
            "type": "string",
            "enum": [
              "OAUTH",
              "API_KEY",
              "BASIC_AUTH",
              "BEARER_TOKEN",
              "CUSTOM",
              "BASIC",
              "OAUTH_M2M",
              "TRELLO_OAUTH1",
              "GOOGLE_DWD",
              "TRUSTED_IDP",
              "SMART_FHIR",
              "NO_AUTH"
            ],
            "example": "OAUTH",
            "description": "The authorization type of the connected account"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "EXPIRED",
              "PENDING_AUTH",
              "PENDING_VERIFICATION",
              "DISCONNECTED"
            ],
            "example": "EXPIRED",
            "description": "The new status of the connected account"
          },
          "old_status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "EXPIRED",
              "PENDING_AUTH",
              "PENDING_VERIFICATION",
              "DISCONNECTED"
            ],
            "example": "ACTIVE",
            "description": "The previous status of the connected account"
          }
        }
      },
      "ConnectedAccountEventData": {
        "type": "object",
        "description": "The connected account the event is about.",
        "required": [
          "id",
          "identifier",
          "connection_id",
          "provider",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ca_",
            "example": "ca_101531404000559370",
            "description": "Connected account identifier"
          },
          "identifier": {
            "type": "string",
            "example": "user_123",
            "description": "End-user identifier for the connected account"
          },
          "connection_id": {
            "type": "string",
            "pattern": "^conn_",
            "example": "conn_100668583155073286",
            "description": "Connection identifier"
          },
          "connection_name": {
            "type": "string",
            "example": "gmail",
            "description": "The connection's name, as shown in AgentKit > Connections. Omitted when it can't be resolved."
          },
          "provider": {
            "type": "string",
            "example": "GMAIL",
            "description": "Provider of the connected account"
          },
          "authorization_type": {
            "type": "string",
            "enum": [
              "OAUTH",
              "API_KEY",
              "BASIC_AUTH",
              "BEARER_TOKEN",
              "CUSTOM",
              "BASIC",
              "OAUTH_M2M",
              "TRELLO_OAUTH1",
              "GOOGLE_DWD",
              "TRUSTED_IDP",
              "SMART_FHIR",
              "NO_AUTH"
            ],
            "example": "OAUTH",
            "description": "Authorization type of the connected account"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "EXPIRED",
              "PENDING_AUTH",
              "PENDING_VERIFICATION",
              "DISCONNECTED"
            ],
            "example": "ACTIVE",
            "description": "Current connected account status"
          },
          "token_expires_at": {
            "type": "string",
            "format": "date-time",
            "example": "2025-12-02T06:59:57.237447Z",
            "description": "When the access token expires, if known"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "example": "2025-12-02T06:00:01.374253Z",
            "description": "When the connected account was last used"
          }
        }
      },
      "ConnectedAccountCreatedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.created webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.created"
            ],
            "example": "connected_account.created"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountUpdatedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.updated webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.updated"
            ],
            "example": "connected_account.updated"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountDeletedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.deleted webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.deleted"
            ],
            "example": "connected_account.deleted"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountMagicLinkGeneratedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.magic_link_generated webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.magic_link_generated"
            ],
            "example": "connected_account.magic_link_generated"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountOauthTokensFetchedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.oauth_tokens_fetched webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data",
          "display_name"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.oauth_tokens_fetched"
            ],
            "example": "connected_account.oauth_tokens_fetched"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          },
          "display_name": {
            "type": "string",
            "example": "OAuth tokens fetched",
            "description": "Human-readable name for the event type"
          }
        }
      },
      "ConnectedAccountTokenRefreshSucceededEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.token_refresh_succeeded webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.token_refresh_succeeded"
            ],
            "example": "connected_account.token_refresh_succeeded"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountTokenRefreshFailedEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.token_refresh_failed webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.token_refresh_failed"
            ],
            "example": "connected_account.token_refresh_failed"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          }
        }
      },
      "ConnectedAccountOauthSucceededEvent": {
        "type": "object",
        "description": "Payload delivered for the connected_account.oauth_succeeded webhook event.",
        "required": [
          "spec_version",
          "id",
          "type",
          "occurred_at",
          "environment_id",
          "object",
          "data",
          "display_name"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "example": "1",
            "description": "The webhook specification version",
            "pattern": "^[0-9]+$"
          },
          "id": {
            "type": "string",
            "pattern": "^evt_",
            "description": "Unique identifier for the webhook event (must be prefixed with \"evt_\")"
          },
          "type": {
            "type": "string",
            "description": "The event type",
            "enum": [
              "connected_account.oauth_succeeded"
            ],
            "example": "connected_account.oauth_succeeded"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event occurred (ISO 8601 format)"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^env_",
            "description": "The environment ID where the event occurred"
          },
          "organization_id": {
            "type": "string",
            "pattern": "^org_",
            "description": "The organization ID (if applicable)"
          },
          "object": {
            "type": "string",
            "description": "The type of object that triggered the webhook",
            "enum": [
              "ConnectedAccount"
            ],
            "example": "ConnectedAccount"
          },
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountEventData"
          },
          "display_name": {
            "type": "string",
            "example": "OAuth authentication successful",
            "description": "Human-readable name for the event type"
          }
        }
      },
      "TriggerServiceBatchCreateTriggerSubscriptionsBody": {
        "type": "object",
        "required": [
          "trigger_name"
        ],
        "properties": {
          "config": {
            "description": "Filter values applied to every account in the batch, keyed by the trigger's config_fields keys. Each account gets its own subscription with these values, so subscribing the same accounts again with different values adds subscriptions rather than replacing these. Invalid values refuse the whole request.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "channel": "C0123456789"
              }
            ]
          },
          "connected_account_ids": {
            "description": "Connected accounts to subscribe, at most 100 — one page of the account picker — with no repeats. Which to send depends on the trigger's delivery_scope, from ListAvailableTriggers. For an ACCOUNT-scoped trigger, list at least one account; an empty list refuses the whole request with a 400. For a CONNECTION-scoped trigger, send an empty list: the trigger is subscribed once, on the connection itself, and results holds exactly one result, with an empty connected_account_id. Naming accounts for a connection-scoped trigger refuses each of them (REFUSED), since that trigger is not subscribed per account.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "ca_123456789012345",
                "ca_123456789012346"
              ]
            ]
          },
          "interval_seconds": {
            "description": "Polling interval in seconds, for a polled trigger only, applied to every account in the batch. Omit it to use the trigger's default_interval_seconds. A value below the trigger's min_interval_seconds, or any value for a webhook trigger, refuses the whole request. A large batch of polled subscriptions shares the environment's polling budget, so the subscriptions can run slower than requested; effective_interval_seconds on each subscription shows the interval it runs at.",
            "type": "integer",
            "format": "int32",
            "examples": [
              300
            ]
          },
          "trigger_name": {
            "description": "Name of the trigger to subscribe to, as returned in the name field of ListAvailableTriggers. Up to 128 characters.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          }
        }
      },
      "TriggerServiceBatchDeleteTriggerSubscriptionsBody": {
        "description": "Which subscriptions to delete: subscription_ids, or trigger_name with connected_account_ids.\n\nSend exactly one selector; any other combination is refused with 400. trigger_name alone, which\nwould name every subscription to a trigger, is deliberately not a selector: to delete those, page\nListTriggerSubscriptions and send the IDs.",
        "type": "object",
        "properties": {
          "connected_account_ids": {
            "description": "With trigger_name, the other selector: connected account IDs (`ca_`) whose subscriptions to trigger_name to delete, at most 100, with no repeats. One account can hold several subscriptions to one trigger, one per filter; each is deleted and gets its own result. Results are grouped by account in the order sent and, within an account, ordered by ascending subscription ID. An account with no matching subscription gets one NOT_FOUND result with an empty subscription_id. A connection-scoped subscription names no account, so it is never matched here: delete it by subscription_ids.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "ca_123456789012345",
                "ca_123456789012346"
              ]
            ]
          },
          "subscription_ids": {
            "description": "Trigger subscription IDs (`trgs_`) to delete, at most 100, with no repeats. One of the two selectors: send either this, or trigger_name with connected_account_ids, never both. Results come back one per ID, in the order sent. Works for account-scoped and connection-scoped subscriptions alike.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "trgs_28128748834787841",
                "trgs_28128748834787842"
              ]
            ]
          },
          "trigger_name": {
            "description": "With connected_account_ids, the other selector: deletes every subscription the listed accounts hold to this trigger on this connection, whatever its filter. Must be sent together with connected_account_ids; sent alone it is refused, so no request can delete every subscription to a trigger. Not checked against the trigger catalogue: a name no subscription uses gives NOT_FOUND for every account. At most 128 characters.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          }
        }
      },
      "TriggerServiceConfirmTriggerSigningSecretRotationBody": {
        "type": "object",
        "properties": {
          "signing_secret_rotation_id": {
            "description": "The rotation to confirm: the signing_secret_rotation_id from the latest SetTriggerSigningSecret or GetTriggerIngressEndpoint response. Required while a rotation is in progress; a missing or non-matching value is then refused with 400, rather than confirming a rotation you did not look at. Ignored when no rotation is in progress.",
            "type": "string",
            "format": "int64",
            "examples": [
              3
            ]
          }
        }
      },
      "TriggerServiceCreateTriggerSubscriptionBody": {
        "type": "object",
        "required": [
          "trigger_name"
        ],
        "properties": {
          "config": {
            "description": "Filter values for the subscription, keyed by the trigger's config_fields keys, spelled exactly as returned. Every required field must be set. An unknown key, or a value longer than 512 characters, is refused. Subscribing again with different values creates another subscription; subscribing again with identical values returns 409.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "channel": "C0123456789"
              }
            ]
          },
          "connected_account_id": {
            "description": "Connected account to subscribe on, for an account-scoped trigger. Omit it for a connection-scoped trigger — the trigger is then subscribed on the connection itself and no account is named. Whether omitting it is valid depends on the trigger's own delivery_scope.",
            "type": "string",
            "examples": [
              "ca_123456789012345"
            ]
          },
          "interval_seconds": {
            "description": "Polling interval in seconds, for a polled trigger only. Omit it to use the trigger's default_interval_seconds. A value below the trigger's min_interval_seconds is refused, naming the minimum, rather than rounded up. Setting it for a webhook trigger is refused. The subscription can run slower than requested when the environment's polling budget is shared across many polled subscriptions; effective_interval_seconds on the response shows the interval it runs at.",
            "type": "integer",
            "format": "int32",
            "examples": [
              300
            ]
          },
          "trigger_name": {
            "description": "Name of the trigger to subscribe to, as returned in the name field of ListAvailableTriggers. Up to 128 characters.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          }
        }
      },
      "TriggerServiceGenerateTriggerSigningSecretBody": {
        "type": "object"
      },
      "TriggerServiceRecoverTriggerDeliveriesBody": {
        "description": "The endpoint and the window to recover failed deliveries for.\n\nThe window must not start or end in the future, must end after it starts, and must span at most\n14 days; a window that breaks a rule is refused with a 400 that names the rule.",
        "type": "object",
        "required": [
          "since"
        ],
        "properties": {
          "since": {
            "description": "Start of the window, inclusive: events with a failed attempt to this endpoint at or after this instant are recovered. Must not be in the future, and must be at most 14 days before `until`, or before now when `until` is omitted.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-08T00:00:00Z"
            ]
          },
          "until": {
            "description": "End of the window, exclusive. Omit it to recover up to now. Must be after `since`, must not be in the future, and must be at most 14 days after `since`.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-09T00:00:00Z"
            ]
          }
        }
      },
      "TriggerServiceSetTriggerSigningSecretBody": {
        "type": "object",
        "required": [
          "signing_secret"
        ],
        "properties": {
          "signing_secret": {
            "description": "The secret the provider signs its events with, copied from the provider's app configuration. For Slack this is the Signing Secret under Basic Information, not an API token. Between 8 and 4096 characters. For Gong, the RSA public key shown by 'Show public key'. Never returned by any endpoint and never written to a log.",
            "type": "string"
          }
        }
      },
      "protobufEmpty": {
        "description": "service Foo {\n      rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n    }",
        "type": "object",
        "title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:"
      },
      "triggersAccountHealth": {
        "description": "Whether a connected account can receive triggers at all.\n\nWorked out from the account's current state on every read.",
        "type": "object",
        "properties": {
          "action": {
            "description": "The single action that resolves this state, so a client renders one button rather than inventing its own mapping. Unspecified when there is nothing to do.",
            "$ref": "#/components/schemas/triggersAccountHealthAction",
            "examples": [
              "RECONNECT"
            ]
          },
          "blocks_tool_calls": {
            "description": "Whether the account's credential itself is unusable, so tool calls made with it fail too. True only for NEEDS_REAUTHENTICATION. False for AWAITING_CONFIRMATION and WRONG_APP: the credential still works and tool calls still succeed, so an agent should keep using the account; only trigger events cannot reach it.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "reason": {
            "description": "Why the account is in this state. Empty when the state is READY.",
            "type": "string",
            "examples": [
              "This account was disconnected."
            ]
          },
          "remedy": {
            "description": "What to do about it. Empty when the state is READY.",
            "type": "string",
            "examples": [
              "Connect the account again to resume triggers."
            ]
          },
          "state": {
            "description": "READY — the account can receive triggers. AWAITING_CONFIRMATION — connected and working, but Scalekit has not confirmed which provider workspace or user it belongs to, so inbound events cannot be routed to it. WRONG_APP — authorized under a different OAuth app than the connection now uses. DISCONNECTED — the account was disconnected. NEEDS_REAUTHENTICATION — the credential itself is unusable, because it has expired or the account has not finished connecting.",
            "$ref": "#/components/schemas/triggersAccountHealthState",
            "examples": [
              "AWAITING_CONFIRMATION"
            ]
          }
        }
      },
      "triggersAccountHealthAction": {
        "description": "The single action that resolves an account's health state.\n\n - RECONNECT: Have the account's user connect the account again.\n - COMPLETE_SETUP: Have the account's user finish the connection flow the\naccount started.",
        "type": "string",
        "enum": [
          "RECONNECT",
          "COMPLETE_SETUP"
        ]
      },
      "triggersAccountHealthState": {
        "description": "A connected account's own state, evaluated for what the trigger in question routes by: a webhook\ntrigger needs the provider workspace captured, and an account-scoped webhook trigger the provider\nuser too.\n\n - READY: The account can receive triggers.\n - AWAITING_CONFIRMATION: Connected and working, but Scalekit has not confirmed\nwhich provider workspace or user it belongs to, so inbound events cannot be routed to it.\n - WRONG_APP: Authorized under a different OAuth app than the connection now\nuses.\n - DISCONNECTED: The account was disconnected.\n - NEEDS_REAUTHENTICATION: The credential itself is unusable: it has expired,\nor the account has not finished connecting.",
        "type": "string",
        "enum": [
          "READY",
          "AWAITING_CONFIRMATION",
          "WRONG_APP",
          "DISCONNECTED",
          "NEEDS_REAUTHENTICATION"
        ]
      },
      "triggersAvailableTrigger": {
        "description": "One trigger, as it applies to one connection.",
        "type": "object",
        "properties": {
          "available": {
            "description": "Whether this trigger can run on this connection. False does not mean the trigger is unsupported by the provider — it means something about THIS connection prevents it, and reason and remedy say what.",
            "type": "boolean"
          },
          "config_fields": {
            "description": "Values a subscription can set in its config map to narrow which events it receives. A config key not listed here is refused.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersConfigField"
            }
          },
          "default_interval_seconds": {
            "description": "Polling interval, in seconds, a subscription uses when it does not set interval_seconds. Zero for a webhook trigger.",
            "type": "integer",
            "format": "int32",
            "examples": [
              300
            ]
          },
          "delivery_scope": {
            "description": "Whether this trigger delivers one event per connected account or one event for the whole connection, whatever accounts exist on it. Decides how the trigger is subscribed: an account-scoped trigger is subscribed on one connected account, a connection-scoped one on the connection itself, naming no account.",
            "$ref": "#/components/schemas/triggersTriggerDeliveryScope",
            "examples": [
              "ACCOUNT"
            ]
          },
          "description": {
            "description": "What event the trigger reports.",
            "type": "string",
            "examples": [
              "Fires when a new message is posted in a channel."
            ]
          },
          "display_name": {
            "description": "Human-readable name of the trigger.",
            "type": "string",
            "examples": [
              "Message posted"
            ]
          },
          "min_interval_seconds": {
            "description": "Shortest polling interval, in seconds, a subscription to this trigger may request. A lower interval_seconds is refused rather than rounded up. Zero for a webhook trigger, which has no interval.",
            "type": "integer",
            "format": "int32",
            "examples": [
              60
            ]
          },
          "mode": {
            "description": "How the trigger detects events. WEBHOOK - the provider sends each event to the connection's webhook URL, so the connection needs a webhook URL registered with the provider. POLL - Scalekit checks the provider on an interval, so a subscription can set interval_seconds.",
            "$ref": "#/components/schemas/triggersTriggerMode",
            "examples": [
              "WEBHOOK"
            ]
          },
          "name": {
            "description": "Unique name of the trigger within its provider. Pass it as trigger_name when listing eligible accounts or creating a subscription.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          },
          "platform_credentials": {
            "description": "Whether this trigger works on a connection that uses Scalekit's shared provider app. UNSUPPORTED means the connection needs the customer's own provider app before this trigger can run; combine it with connection_uses_shared_app on the list response to decide whether to ask for one. UNSPECIFIED when the trigger declares a value this server does not recognise.",
            "$ref": "#/components/schemas/triggersTriggerPlatformCredentials",
            "examples": [
              "UNSUPPORTED"
            ]
          },
          "provider": {
            "description": "The provider the trigger belongs to, the same as the connection's provider.",
            "type": "string",
            "examples": [
              "slack"
            ]
          },
          "provides_bearer_secret": {
            "description": "Whether Scalekit generates this trigger's signing secret (GenerateTriggerSigningSecret) rather than the customer copying one from the provider's console. True only for providers that send no signature of their own. Always false for a polled trigger.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "reason": {
            "description": "Why the trigger is unavailable on this connection. Populated whenever available is false.",
            "type": "string",
            "examples": [
              "This connection uses Scalekit's shared slack app, and a webhook URL is registered against the app rather than the connection — the shared app has only one."
            ]
          },
          "refusal_code": {
            "description": "The stable code of the connection-level rule that made this trigger unavailable. SHARED_APP — the connection uses Scalekit's shared provider app. POLL_CONNECTION_SCOPE — a polled trigger cannot be connection-scoped. UNSPECIFIED when the trigger is available, or when a rule without a code refused it; reason and remedy are populated either way.",
            "$ref": "#/components/schemas/triggersTriggerRefusalCode",
            "examples": [
              "SHARED_APP"
            ]
          },
          "register_hint": {
            "description": "Provider-specific guidance on where to register the connection's ingress URL in the provider's console, written by the connector author. At most 500 characters, with no control characters. Empty when the connector provides none, and always empty for a polled trigger.",
            "type": "string",
            "examples": [
              "api.slack.com/apps → your app → Event Subscriptions → turn on Enable Events → paste into Request URL."
            ]
          },
          "remedy": {
            "description": "What to do to make the trigger available. Populated whenever available is false.",
            "type": "string",
            "examples": [
              "Add your own slack app to this connection, then subscribe."
            ]
          },
          "required_scopes": {
            "description": "Permissions a connected account's grant must include to subscribe to this trigger. A subscription for an account whose grant lacks one of them is refused, naming the missing scope.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersRequiredScope"
            }
          },
          "requires_signing_secret": {
            "description": "Whether the provider signs this trigger's events with a secret the customer copies from the provider's console and sets on the connection's ingress endpoint. Always false for a polled trigger, which receives no inbound requests.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "secret_hint": {
            "description": "Provider-specific guidance on where the provider shows the signing secret to copy, written by the connector author. At most 500 characters, with no control characters. Empty when the connector provides none, and always empty for a polled trigger.",
            "type": "string",
            "examples": [
              "Your app → Basic Information → App Credentials → Signing Secret."
            ]
          }
        }
      },
      "triggersBatchCreateTriggerSubscriptionResult": {
        "description": "One account's result within a batch.",
        "type": "object",
        "properties": {
          "connected_account_id": {
            "description": "The connected account ID this result is for, as sent in the request.",
            "type": "string",
            "examples": [
              "ca_123456789012345"
            ]
          },
          "outcome": {
            "description": "What happened to this account. CREATED — a subscription was created. ALREADY_SUBSCRIBED — the account already had a subscription to this trigger with these exact config values; nothing new was created, and list subscriptions to read the existing one. REFUSED — the account cannot receive this trigger; reason says why and what to do. NOT_FOUND — no such account on this connection in this environment. FAILED — the attempt failed for a reason unrelated to the account; nothing was created, and retrying may succeed.",
            "$ref": "#/components/schemas/triggersBatchSubscribeOutcome",
            "examples": [
              "CREATED"
            ]
          },
          "reason": {
            "description": "Why the account was not subscribed, and for a refusal what to do about it, in one sentence — the same text CreateTriggerSubscription returns for the same account. Empty for CREATED.",
            "type": "string",
            "examples": [
              "connected account not found"
            ]
          },
          "subscription": {
            "description": "The created subscription, for CREATED. Absent for every other outcome, including ALREADY_SUBSCRIBED.",
            "$ref": "#/components/schemas/triggersTriggerSubscription"
          }
        }
      },
      "triggersBatchCreateTriggerSubscriptionsResponse": {
        "type": "object",
        "properties": {
          "created_count": {
            "description": "How many subscriptions this call created. Excludes accounts that were already subscribed.",
            "type": "integer",
            "format": "int64",
            "examples": [
              98
            ]
          },
          "results": {
            "description": "One result per requested account, in the order the accounts were sent, so a client can pair them up positionally without matching on id. For a connection-scoped trigger subscribed with an empty connected_account_ids, exactly one result, with an empty connected_account_id.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersBatchCreateTriggerSubscriptionResult"
            }
          }
        }
      },
      "triggersBatchDeleteOutcome": {
        "description": "What happened to one subscription in a batch delete.\n\n - BATCH_DELETE_OUTCOME_DELETED: The subscription was deleted by this call.\n - BATCH_DELETE_OUTCOME_NOT_FOUND: No such subscription on this connection\nin this environment — including one an earlier attempt already deleted, which is what makes retrying the whole batch safe. Another\nconnection's or another tenant's subscription is reported exactly like a missing one.\n - BATCH_DELETE_OUTCOME_FAILED: The delete could not be completed. It may\nor may not have happened; retrying is safe and answers DELETED or NOT_FOUND.\n - BATCH_DELETE_OUTCOME_NOT_ATTEMPTED: The request ran out of time before\nthis subscription was reached. Nothing was changed for it; send it again.",
        "type": "string",
        "enum": [
          "BATCH_DELETE_OUTCOME_DELETED",
          "BATCH_DELETE_OUTCOME_NOT_FOUND",
          "BATCH_DELETE_OUTCOME_FAILED",
          "BATCH_DELETE_OUTCOME_NOT_ATTEMPTED"
        ]
      },
      "triggersBatchDeleteTriggerSubscriptionResult": {
        "description": "One subscription's result within a batch delete.",
        "type": "object",
        "properties": {
          "connected_account_id": {
            "description": "For trigger_name with connected_account_ids, the account this result belongs to, as sent. Always empty for a subscription_ids request.",
            "type": "string",
            "examples": [
              "ca_123456789012345"
            ]
          },
          "outcome": {
            "description": "What happened to this subscription. BATCH_DELETE_OUTCOME_DELETED — deleted by this call. BATCH_DELETE_OUTCOME_NOT_FOUND — no such subscription on this connection in this environment, including one an earlier attempt already deleted; treat it like DELETED when retrying. BATCH_DELETE_OUTCOME_FAILED — the delete could not be completed and may or may not have happened; retrying is safe. BATCH_DELETE_OUTCOME_NOT_ATTEMPTED — the request ran out of time before reaching this subscription; nothing was changed for it, so send it again.",
            "$ref": "#/components/schemas/triggersBatchDeleteOutcome",
            "examples": [
              "BATCH_DELETE_OUTCOME_DELETED"
            ]
          },
          "reason": {
            "description": "One sentence explaining the outcome. Empty for BATCH_DELETE_OUTCOME_DELETED. Never contains internal error detail. The wording can change: match on outcome, not on this text.",
            "type": "string",
            "examples": [
              "trigger subscription not found"
            ]
          },
          "subscription_id": {
            "description": "The subscription this result is about. For subscription_ids, the ID exactly as sent. For trigger_name with connected_account_ids, a subscription found for the account; empty only on the single NOT_FOUND result of an account that held no matching subscription.",
            "type": "string",
            "examples": [
              "trgs_28128748834787841"
            ]
          }
        }
      },
      "triggersBatchDeleteTriggerSubscriptionsResponse": {
        "type": "object",
        "properties": {
          "deleted_count": {
            "description": "How many subscriptions this call deleted. Excludes NOT_FOUND results, so a subscription an earlier attempt already deleted is not counted again.",
            "type": "integer",
            "format": "int64",
            "examples": [
              2
            ]
          },
          "results": {
            "description": "For subscription_ids, one result per ID in the order sent, so a client can pair them up positionally. For trigger_name with connected_account_ids, the results are grouped by account in the order sent, ordered by ascending subscription ID within an account, with one NOT_FOUND result for an account that held no matching subscription.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersBatchDeleteTriggerSubscriptionResult"
            }
          }
        }
      },
      "triggersBatchLookupOutcome": {
        "description": "What happened to one ID in a batch lookup.\n\n - BATCH_LOOKUP_OUTCOME_FOUND: The event was found; the result's delivery\nholds it.\n - BATCH_LOOKUP_OUTCOME_NOT_FOUND: No trigger event with this message ID or\nevent ID exists in this environment. An ID from another environment is reported exactly like a missing one.\n - BATCH_LOOKUP_OUTCOME_RATE_LIMITED: The read was refused for volume. The\nbatch stops: every ID that had not started by then is NOT_ATTEMPTED, wherever it sits in the list.\n - BATCH_LOOKUP_OUTCOME_FAILED: The lookup could not be completed; retrying\nmay succeed.\n - BATCH_LOOKUP_OUTCOME_NOT_ATTEMPTED: Not looked up, because an earlier ID\nwas rate limited or the request ran out of time.",
        "type": "string",
        "enum": [
          "BATCH_LOOKUP_OUTCOME_FOUND",
          "BATCH_LOOKUP_OUTCOME_NOT_FOUND",
          "BATCH_LOOKUP_OUTCOME_RATE_LIMITED",
          "BATCH_LOOKUP_OUTCOME_FAILED",
          "BATCH_LOOKUP_OUTCOME_NOT_ATTEMPTED"
        ]
      },
      "triggersBatchLookupTriggerDeliveriesRequest": {
        "type": "object",
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "description": "Message IDs (`msg_…`, sent to the endpoint as the `webhook-id` header) or event IDs (the payload's `dedupe_key`) of the trigger events to find, in any mix: at least 1 and at most 25, with no repeats. Each is 1 to 256 characters: letters, digits, `.`, `_` and `-`. An attempt ID (`atmpt_…`) refuses the whole request.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0",
                "ca_5F28128748834787840.trgs_5F28128748834787841.Ev07ABCDEF12"
              ]
            ]
          }
        }
      },
      "triggersBatchLookupTriggerDeliveriesResponse": {
        "type": "object",
        "properties": {
          "found_count": {
            "description": "How many of the requested IDs were found.",
            "type": "integer",
            "format": "int64",
            "examples": [
              24
            ]
          },
          "results": {
            "description": "One result per requested ID, in the order the IDs were sent, so a client can pair them up positionally.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersBatchLookupTriggerDeliveryResult"
            }
          }
        }
      },
      "triggersBatchLookupTriggerDeliveryResult": {
        "description": "One ID's result within a batch lookup.",
        "type": "object",
        "properties": {
          "delivery": {
            "description": "The event and its delivery attempts to every endpoint, oldest first, as LookupTriggerDelivery returns them, except that no attempt carries a response body: each attempt's `response` is empty and its `response_truncated` is false. `truncated` keeps its meaning: true when the event has more than the 50 attempts returned. Present only for BATCH_LOOKUP_OUTCOME_FOUND.",
            "$ref": "#/components/schemas/triggersLookupTriggerDeliveryResponse"
          },
          "id": {
            "description": "The ID this result is about, exactly as sent.",
            "type": "string",
            "examples": [
              "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0"
            ]
          },
          "outcome": {
            "description": "What happened to this ID. BATCH_LOOKUP_OUTCOME_FOUND — the event was found and delivery holds it. BATCH_LOOKUP_OUTCOME_NOT_FOUND — no trigger event with this message ID or event ID exists in this environment. BATCH_LOOKUP_OUTCOME_RATE_LIMITED — the read was refused for volume; look the ID up again shortly. BATCH_LOOKUP_OUTCOME_FAILED — the lookup could not be completed; retrying may succeed. BATCH_LOOKUP_OUTCOME_NOT_ATTEMPTED — not looked up, because an earlier ID was rate limited or the request ran out of time; send it again.",
            "$ref": "#/components/schemas/triggersBatchLookupOutcome",
            "examples": [
              "BATCH_LOOKUP_OUTCOME_FOUND"
            ]
          },
          "reason": {
            "description": "One sentence explaining the outcome. Empty for BATCH_LOOKUP_OUTCOME_FOUND. Never contains internal error detail. The wording can change: match on outcome, not on this text.",
            "type": "string",
            "examples": [
              "no trigger delivery with this id exists in this environment"
            ]
          }
        }
      },
      "triggersBatchResendOutcome": {
        "description": "What happened to one target in a batch resend.\n\n - BATCH_RESEND_OUTCOME_QUEUED: A new manual delivery attempt was queued.\nNot yet delivered: its outcome appears with the message's other attempts.\n - BATCH_RESEND_OUTCOME_NOT_FOUND: The message or the endpoint does not exist\nin this environment's trigger delivery application. Another environment's IDs are reported exactly like missing ones.\n - BATCH_RESEND_OUTCOME_RATE_LIMITED: Refused for volume. The batch stops:\nevery target that had not started by then is NOT_ATTEMPTED, wherever it sits in the list.\n - BATCH_RESEND_OUTCOME_FAILED: No new attempt could be confirmed as queued.\nA target whose request timed out may still have been queued, so retrying it can queue a second attempt. A target whose event payload is no\nlonger stored is also FAILED, and resending it can never succeed; its reason says so.\n - BATCH_RESEND_OUTCOME_NOT_ATTEMPTED: Not sent, because an earlier target\nwas rate limited or the request ran out of time. Nothing was queued for it.",
        "type": "string",
        "enum": [
          "BATCH_RESEND_OUTCOME_QUEUED",
          "BATCH_RESEND_OUTCOME_NOT_FOUND",
          "BATCH_RESEND_OUTCOME_RATE_LIMITED",
          "BATCH_RESEND_OUTCOME_FAILED",
          "BATCH_RESEND_OUTCOME_NOT_ATTEMPTED"
        ]
      },
      "triggersBatchResendTriggerDeliveriesRequest": {
        "description": "The deliveries to retry. A repeated msg_id and endpoint_id pair is refused by the service:\nunique cannot be declared on a list of messages, and sending the pair twice would queue two\nattempts.",
        "type": "object",
        "required": [
          "targets"
        ],
        "properties": {
          "targets": {
            "description": "The deliveries to retry, each a message ID and an endpoint ID: at least 1 and at most 50. A msg_id and endpoint_id pair may appear only once; a repeated pair refuses the whole request rather than queueing two attempts. The same message may appear with different endpoints, and the same endpoint with different messages.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerDeliveryResendTarget"
            }
          }
        }
      },
      "triggersBatchResendTriggerDeliveriesResponse": {
        "type": "object",
        "properties": {
          "queued_count": {
            "description": "How many new delivery attempts this call queued.",
            "type": "integer",
            "format": "int64",
            "examples": [
              12
            ]
          },
          "results": {
            "description": "One result per target, in the order the targets were sent, so a client can pair them up positionally.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersBatchResendTriggerDeliveryResult"
            }
          }
        }
      },
      "triggersBatchResendTriggerDeliveryResult": {
        "description": "One target's result within a batch resend.",
        "type": "object",
        "properties": {
          "endpoint_id": {
            "description": "Endpoint ID of the target, exactly as sent.",
            "type": "string",
            "examples": [
              "ep_2yAqUuFkqbL5nXvC7HhWJRY6Gg9"
            ]
          },
          "msg_id": {
            "description": "Message ID of the target, exactly as sent.",
            "type": "string",
            "examples": [
              "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0"
            ]
          },
          "outcome": {
            "description": "What happened to this target. BATCH_RESEND_OUTCOME_QUEUED — a new manual attempt was queued; it has not been delivered yet. BATCH_RESEND_OUTCOME_NOT_FOUND — the message or the endpoint does not exist in this environment. BATCH_RESEND_OUTCOME_RATE_LIMITED — refused for volume; send this target again shortly. BATCH_RESEND_OUTCOME_FAILED — no new attempt could be confirmed as queued; one whose request timed out may still have been, so a retry can queue a second attempt. A target whose event payload is no longer stored is also FAILED, with a reason saying it cannot be resent; retrying it will not help. BATCH_RESEND_OUTCOME_NOT_ATTEMPTED — not sent, because an earlier target was rate limited or the request ran out of time; nothing was queued for it.",
            "$ref": "#/components/schemas/triggersBatchResendOutcome",
            "examples": [
              "BATCH_RESEND_OUTCOME_QUEUED"
            ]
          },
          "reason": {
            "description": "One sentence explaining the outcome. Empty for BATCH_RESEND_OUTCOME_QUEUED. Never contains internal error detail. The wording can change: match on outcome, not on this text.",
            "type": "string",
            "examples": [
              "not attempted: an earlier target was rate limited; resend this target shortly"
            ]
          }
        }
      },
      "triggersBatchSubscribeOutcome": {
        "description": "What happened to one account in a batch.\n\n - CREATED: A subscription was created for this account.\n - ALREADY_SUBSCRIBED: This account already had a subscription to this trigger\nwith this exact filter, so nothing new was created. Not an error — it is what makes retrying a partly-failed batch safe.\n - REFUSED: This account cannot receive this trigger. reason and remedy say\nwhy and what to do.\n - NOT_FOUND: No such account on this connection, in this environment.\n - FAILED: The attempt failed for a reason unrelated to this account — nothing\nwas created for it, and retrying it may succeed.",
        "type": "string",
        "enum": [
          "CREATED",
          "ALREADY_SUBSCRIBED",
          "REFUSED",
          "NOT_FOUND",
          "FAILED"
        ]
      },
      "triggersConfigField": {
        "description": "A value a subscriber can set on a subscription to this trigger, such as the channel to watch.\n\nDerived from the conditions the trigger matches events on, so every field listed here is read by\none of those conditions.",
        "type": "object",
        "properties": {
          "display_name": {
            "description": "Human-readable label for the field.",
            "type": "string",
            "examples": [
              "Channel"
            ]
          },
          "help_text": {
            "description": "Guidance on what to enter. Empty when the trigger provides none.",
            "type": "string",
            "examples": [
              "The ID of the channel to watch for new messages."
            ]
          },
          "key": {
            "description": "The key to send in a subscription's config map. Send it exactly as returned, without changing its case: a key that does not match is refused.",
            "type": "string",
            "examples": [
              "channel"
            ]
          },
          "placeholder": {
            "description": "Example value to show in an empty input. Empty when the trigger provides none.",
            "type": "string",
            "examples": [
              "C0123456789"
            ]
          },
          "required": {
            "description": "Whether a subscription must set this field to a non-empty value. A subscription request that omits a required field is refused.",
            "type": "boolean",
            "examples": [
              true
            ]
          }
        }
      },
      "triggersEligibleAccount": {
        "description": "A connected account, with whether it can receive a particular trigger.",
        "type": "object",
        "properties": {
          "eligible": {
            "description": "Whether this account can be subscribed to the trigger. When false, reason and remedy explain why and what to do.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "health": {
            "description": "The account's own state, evaluated for what this trigger needs captured on the account: a webhook trigger needs the provider workspace, and an account-scoped webhook trigger also needs the provider user. A polled trigger needs neither, so the same account can be READY for one trigger and AWAITING_CONFIRMATION for another. Carried alongside eligible because they answer different questions: eligible is whether this trigger can be subscribed on this account, health is the account's own state and the single action that resolves it.",
            "$ref": "#/components/schemas/triggersAccountHealth"
          },
          "id": {
            "description": "ID of the connected account. Pass it as connected_account_id when creating a subscription.",
            "type": "string",
            "examples": [
              "ca_123456789012345"
            ]
          },
          "identifier": {
            "description": "The identifier the connected account was created with: the value you passed as identifier, such as your app's user ID or the user's email address. When the account has no identifier, this is the connected account ID.",
            "type": "string",
            "examples": [
              "user_123"
            ]
          },
          "reason": {
            "description": "Why this account cannot receive the trigger. Populated whenever eligible is false.",
            "type": "string",
            "examples": [
              "This account was authorized under a different app than the connection now uses."
            ]
          },
          "remedy": {
            "description": "What to do so the account can receive the trigger. Populated whenever eligible is false.",
            "type": "string",
            "examples": [
              "Re-authorize this account under your app, then subscribe."
            ]
          }
        }
      },
      "triggersGenerateTriggerSigningSecretResponse": {
        "description": "The one response in this API that carries a signing secret in plain text, and the only time\nyou ever see it: endpoint shows the secret masked, as every other webhook URL response does, and\nthe plain text appears only in signing_secret and url_with_secret.",
        "type": "object",
        "properties": {
          "endpoint": {
            "description": "The connection's webhook endpoint after the secret was stored, rendered exactly as GetTriggerIngressEndpoint renders it: the secret appears here only in masked form, and rotation_in_progress is true when this call started a rotation.",
            "$ref": "#/components/schemas/triggersTriggerIngressEndpoint"
          },
          "signing_secret": {
            "description": "The generated secret, in plain text. Returned only in this response and never again by any endpoint, nor written to a log. The provider presents it back on every event in exactly one of three ways: an `Authorization: Bearer <secret>` header, the `X-Scalekit-Webhook-Secret` header, or the final path segment of url_with_secret.",
            "type": "string"
          },
          "url_with_secret": {
            "description": "endpoint.url with the secret appended as a final path segment. Paste this into the provider's console when the provider cannot send a custom header. It is as sensitive as signing_secret and is likewise returned only in this response.",
            "type": "string"
          }
        }
      },
      "triggersGetTriggerActivityResponse": {
        "description": "What happened to this environment's trigger events, and what this cannot tell you.",
        "type": "object",
        "properties": {
          "counts": {
            "description": "Event counts over the window, keyed by outcome. Every key is always present, zeroes included. received — events that arrived at one of the environment's webhook URLs, including those that then failed signature verification. filtered — verified events that no subscription's filter or account matched. unresolved — verified events for a provider workspace that no connected account holds. delivered — events handed off for delivery to your endpoints; this does not confirm that your endpoint received them. delivery_failed — events whose handoff for delivery failed. duplicate — repeated deliveries of an event already received, such as provider retries, which are ignored. signature_failed — events that failed signature verification. discarded — events received while Triggers was not enabled for the environment, and dropped.",
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "int64"
            },
            "examples": [
              {
                "delivered": 88,
                "delivery_failed": 0,
                "discarded": 0,
                "duplicate": 5,
                "filtered": 30,
                "received": 120,
                "signature_failed": 0,
                "unresolved": 2
              }
            ]
          },
          "degraded": {
            "description": "True when some counts could not be read, so the counts are incomplete. Do not read zero counts as \"nothing arrived\" while this is true.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "delivery_details_path": {
            "description": "Path, relative to the Scalekit dashboard, of the trigger delivery page. That page shows each delivery attempt to your endpoints, including failures after an event was handed off for delivery.",
            "type": "string",
            "examples": [
              "/trigger-delivery"
            ]
          },
          "explains_individual_events": {
            "description": "Always false. Trigger events are not stored individually, so no endpoint can explain what happened to one specific event. Show this limitation to the user rather than hiding it.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "signature_banner": {
            "description": "True when at least 5 events in the window failed signature verification and they make up at least half of the events received. This usually means the signing secret set on a connection does not match the provider's. Show it prominently: a provider can disable a webhook URL that keeps failing, and re-enabling it is a manual step in the provider's app configuration.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "window_hours": {
            "description": "How many hours back the counts reach, ending now.",
            "type": "integer",
            "format": "int32",
            "examples": [
              24
            ]
          }
        }
      },
      "triggersGetTriggerUsageResponse": {
        "description": "Metered trigger deliveries in hourly buckets for period 24h, or in UTC daily buckets for every\nother request. Buckets with no deliveries are left out.",
        "type": "object",
        "properties": {
          "bucket": {
            "description": "What each entry counts. `TRIGGER_USAGE_BUCKET_HOUR` for `period=24h`, whose counts are in `hours`. `TRIGGER_USAGE_BUCKET_DAY` for `period=7d` and `period=30d`, whose counts are in `days`. `TRIGGER_USAGE_BUCKET_UNSPECIFIED` when the request used `from` and `to`; those counts are always by UTC day, in `days`.",
            "$ref": "#/components/schemas/triggersTriggerUsageBucket",
            "examples": [
              "TRIGGER_USAGE_BUCKET_HOUR"
            ]
          },
          "current_hour": {
            "description": "Only for `period=24h`, and empty otherwise. The start of the UTC clock hour in progress on the server, as an RFC 3339 timestamp in UTC (`Z`). It is the last of the 24 hours `hours` covers, and its count grows until the hour ends. Returned so a client lays out the 24 hours and marks the one in progress without relying on its own clock.",
            "type": "string",
            "examples": [
              "2026-10-14T18:00:00Z"
            ]
          },
          "days": {
            "description": "One entry per UTC day within the range read (`from`..`to`) that has metered deliveries, oldest first. A day in that range with none is absent rather than listed as zero, so a client that needs a continuous series fills the missing days itself, over the returned `from` and `to` rather than the range it requested. Days outside the range read were not read and must not be drawn as zero. Always empty for `period=24h`, whose counts are in `hours`.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerUsageDay"
            }
          },
          "from": {
            "description": "First UTC calendar date of the range read, as YYYY-MM-DD. For a `from` and `to` request, the requested `from`, or the first day of the readable window, 30 days before `today`, when the request started earlier. For a `period` request, the UTC date of the first hour (`24h`) or the first day (`7d`, `30d`) of the period.",
            "type": "string",
            "examples": [
              "2026-10-01"
            ]
          },
          "hours": {
            "description": "Only for `period=24h`, and empty otherwise. One entry per UTC clock hour that has metered deliveries, oldest first, among the 24 hours from 23 hours before `current_hour` through `current_hour`. An hour in that range with none is absent rather than listed as zero, so a client that needs a continuous series fills the missing hours itself over those 24 hours. Hours outside them were not read and must not be drawn.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerUsageHour"
            }
          },
          "period": {
            "description": "The `period` the request asked for: `24h`, `7d` or `30d`. Empty when the request used `from` and `to`.",
            "type": "string",
            "examples": [
              "24h"
            ]
          },
          "to": {
            "description": "Last UTC calendar date of the range read, as YYYY-MM-DD. For a `from` and `to` request, the requested `to`, or `today` when the request ended later. For a `period` request, always `today`.",
            "type": "string",
            "examples": [
              "2026-10-31"
            ]
          },
          "today": {
            "description": "The server's current UTC calendar date, as YYYY-MM-DD. Deliveries on this day are still being metered, so its count grows until the day ends. The readable window and any clamping of `from` and `to` are measured from this date. Returned so a client tells the day in progress apart from completed days without relying on its own clock.",
            "type": "string",
            "examples": [
              "2026-10-31"
            ]
          }
        }
      },
      "triggersListAvailableTriggersResponse": {
        "type": "object",
        "properties": {
          "connection_uses_shared_app": {
            "description": "Whether the connection is configured to use Scalekit's shared provider app rather than the customer's own. Read from the connection's saved configuration. When true, any trigger with platform_credentials UNSUPPORTED is unavailable until the customer adds their own provider app to the connection.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "triggers": {
            "description": "Every trigger the connection's provider publishes, including unavailable ones. Check available on each before offering it.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersAvailableTrigger"
            }
          }
        }
      },
      "triggersListEligibleAccountsResponse": {
        "type": "object",
        "properties": {
          "accounts": {
            "description": "One page of the connection's connected accounts, eligible and ineligible, each with its health for this trigger.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersEligibleAccount"
            }
          },
          "next_page_token": {
            "description": "Pass as page_token to read the next page. Empty when there is no next page.",
            "type": "string",
            "examples": [
              "<next_page_token>"
            ]
          },
          "prev_page_token": {
            "description": "Pass as page_token to read the previous page. Empty when there is no previous page.",
            "type": "string",
            "examples": [
              "<prev_page_token>"
            ]
          },
          "total_size": {
            "description": "How many of this connection's accounts match the query, across every page. Accounts on other connections are never counted.",
            "type": "integer",
            "format": "int64",
            "examples": [
              104
            ]
          }
        }
      },
      "triggersListTriggerDeliveriesByEndpointResponse": {
        "type": "object",
        "properties": {
          "deliveries": {
            "description": "One page of the endpoint's deliveries that match the filters, newest first.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerDelivery"
            }
          },
          "next_page_token": {
            "description": "Pass this as page_token, with the same endpoint_id and filters, to read the next page of older deliveries. Empty when there are no older deliveries.",
            "type": "string",
            "examples": [
              "<next_page_token>"
            ]
          }
        }
      },
      "triggersListTriggerDeliveryAttemptsByEndpointResponse": {
        "type": "object",
        "properties": {
          "attempts": {
            "description": "The endpoint's most recent delivery attempts, newest first.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerDeliveryAttempt"
            }
          }
        }
      },
      "triggersListTriggerDeliveryAttemptsByMessageResponse": {
        "type": "object",
        "properties": {
          "attempts": {
            "description": "The delivery's attempts to this endpoint, oldest first.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerDeliveryAttempt"
            }
          },
          "truncated": {
            "description": "True when the delivery has more than the 50 attempts returned. The newest 50 are returned, so the first attempt is missing when this is true.",
            "type": "boolean"
          }
        }
      },
      "triggersListTriggerSubscriptionsResponse": {
        "type": "object",
        "properties": {
          "next_page_token": {
            "description": "Pass as page_token to read the next page. Empty when there is no next page.",
            "type": "string",
            "examples": [
              "<next_page_token>"
            ]
          },
          "prev_page_token": {
            "description": "Pass as page_token to read the previous page. Empty when there is no previous page.",
            "type": "string",
            "examples": [
              "<prev_page_token>"
            ]
          },
          "status_counts": {
            "description": "How many subscriptions sit in each status, keyed by the status name. Counted over the whole matching set rather than the current page, so a client can show per-status totals without fetching every page. Honours trigger_name but ignores statuses, so the totals stay still while a customer switches between status filters.",
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            },
            "examples": [
              {
                "ACTIVE": 93,
                "PAUSED": 3,
                "PAUSED_CREDENTIAL": 4
              }
            ]
          },
          "subscriptions": {
            "description": "One page of the connection's trigger subscriptions that match the filters, newest first.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerSubscription"
            }
          },
          "total_size": {
            "description": "How many subscriptions match the filters in total, across every page.",
            "type": "integer",
            "format": "int64",
            "examples": [
              100
            ]
          }
        }
      },
      "triggersLookupTriggerDeliveryResponse": {
        "type": "object",
        "properties": {
          "attempts": {
            "description": "The event's delivery attempts to every endpoint in this environment, oldest first. Each names the endpoint_id and endpoint_url it was sent to.",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/triggersTriggerDeliveryAttempt"
            }
          },
          "connection_id": {
            "description": "ID of the connection the event came from. Present even after the connection is deleted. Empty when the event carries none.",
            "type": "string",
            "examples": [
              "conn_28128748834787840"
            ]
          },
          "connection_key_id": {
            "description": "Key ID of the connection the event came from. Empty when the connection no longer exists.",
            "type": "string",
            "examples": [
              "salesforce-acme"
            ]
          },
          "connection_provider": {
            "description": "Provider of the connection the event came from. Empty when the connection no longer exists.",
            "type": "string",
            "examples": [
              "SALESFORCE"
            ]
          },
          "event_id": {
            "description": "Event ID of the event: the payload's `dedupe_key` and `correlation_id`. Empty when the event was sent without one.",
            "type": "string",
            "examples": [
              "ca_5F28128748834787840.trgs_5F28128748834787841.Ev07ABCDEF12"
            ]
          },
          "message_timestamp": {
            "description": "When the event was accepted for delivery.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-09T12:34:55Z"
            ]
          },
          "msg_id": {
            "description": "Message ID of the event, sent to each endpoint as the `webhook-id` header.",
            "type": "string",
            "examples": [
              "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0"
            ]
          },
          "subscription_id": {
            "description": "ID of the trigger subscription that sent the event. Present even after the subscription is deleted. Empty when the event carries none.",
            "type": "string",
            "examples": [
              "trgs_28128748834787841"
            ]
          },
          "trigger_mode": {
            "description": "How the trigger detects events, from the newest version of its definition: WEBHOOK or POLL. TRIGGER_MODE_UNSPECIFIED when the subscription or the definition no longer exists.",
            "$ref": "#/components/schemas/triggersTriggerMode",
            "examples": [
              "POLL"
            ]
          },
          "trigger_name": {
            "description": "Key of the trigger that fired, as the subscription was created with. Empty when the subscription no longer exists.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          },
          "truncated": {
            "description": "True when the event has more than the 50 attempts returned. The newest 50 are returned, so the earliest attempts are missing when this is true.",
            "type": "boolean"
          }
        }
      },
      "triggersRecoverTriggerDeliveriesResponse": {
        "description": "A recovery that has started. Its outcome is not reported: the recovery runs in the background,\nand no record of it can be read back through the API.",
        "type": "object",
        "properties": {
          "status": {
            "description": "The recovery's state when this call returned. `running` in practice: the recovery continues after the response, and its later state is not reported.",
            "type": "string",
            "examples": [
              "running"
            ]
          },
          "task_id": {
            "description": "Identifies this recovery in Scalekit's logs; quote it when contacting support. It cannot be looked up or polled through the API.",
            "type": "string",
            "examples": [
              "qtask_2yAqV1pZbF8sRj3nWkXcT5mLh0"
            ]
          }
        }
      },
      "triggersRequiredScope": {
        "description": "A permission the trigger needs on the connected account's grant.",
        "type": "object",
        "properties": {
          "grant": {
            "description": "Which grant channel must carry the scope. Some providers fan events out differently for a bot install than for a user install, so this is not merely descriptive.",
            "type": "string",
            "examples": [
              "bot"
            ]
          },
          "scope": {
            "description": "The provider's own name for the permission, exactly as it appears in their console.",
            "type": "string",
            "examples": [
              "channels:history"
            ]
          }
        }
      },
      "triggersTriggerDelivery": {
        "description": "One trigger event's delivery to one endpoint: a single entry however many attempts it took.",
        "type": "object",
        "properties": {
          "connection_id": {
            "description": "ID of the connection the event came from. Present even after the connection is deleted. Empty when the event carries none.",
            "type": "string",
            "examples": [
              "conn_28128748834787840"
            ]
          },
          "connection_key_id": {
            "description": "Key ID of the connection the event came from. Empty when the connection no longer exists.",
            "type": "string",
            "examples": [
              "slack-acme"
            ]
          },
          "connection_provider": {
            "description": "Provider of the connection the event came from. Empty when the connection no longer exists.",
            "type": "string",
            "examples": [
              "SLACK"
            ]
          },
          "endpoint_id": {
            "description": "ID of the endpoint the event was delivered to.",
            "type": "string",
            "examples": [
              "ep_2yAqUuFkqbL5nXvC7HhWJRY6Gg9"
            ]
          },
          "event_id": {
            "description": "Event ID of the event: the payload's `dedupe_key` and `correlation_id`. Empty when the event was sent without one.",
            "type": "string",
            "examples": [
              "ca_5F28128748834787840.trgs_5F28128748834787841.Ev07ABCDEF12"
            ]
          },
          "message_timestamp": {
            "description": "When the event was accepted for delivery.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-09T12:34:55Z"
            ]
          },
          "msg_id": {
            "description": "Message ID of the event, sent to the endpoint as the `webhook-id` header.",
            "type": "string",
            "examples": [
              "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0"
            ]
          },
          "next_attempt_at": {
            "description": "When the next attempt is scheduled. Present only while status is TRIGGER_DELIVERY_STATUS_RETRYING.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-09T12:39:56Z"
            ]
          },
          "status": {
            "description": "The delivery's state across all its attempts.",
            "$ref": "#/components/schemas/triggersTriggerDeliveryStatus",
            "examples": [
              "TRIGGER_DELIVERY_STATUS_RETRYING"
            ]
          },
          "subscription_id": {
            "description": "ID of the trigger subscription that sent the event. Present even after the subscription is deleted. Empty when the event carries none.",
            "type": "string",
            "examples": [
              "trgs_28128748834787841"
            ]
          },
          "trigger_mode": {
            "description": "How the trigger detects events, from the newest version of its definition: WEBHOOK or POLL. The trigger's mode now, not a record of how this one event was detected. TRIGGER_MODE_UNSPECIFIED when the subscription or the definition no longer exists.",
            "$ref": "#/components/schemas/triggersTriggerMode",
            "examples": [
              "WEBHOOK"
            ]
          },
          "trigger_name": {
            "description": "Key of the trigger that fired, as the subscription was created with. Empty when the subscription no longer exists.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          }
        }
      },
      "triggersTriggerDeliveryAttempt": {
        "type": "object",
        "properties": {
          "endpoint_id": {
            "description": "ID of the endpoint this attempt was made against.",
            "type": "string",
            "examples": [
              "ep_123456789012345"
            ]
          },
          "endpoint_url": {
            "description": "URL this attempt was sent to.",
            "type": "string",
            "examples": [
              "https://agent.example.com/hooks/triggers"
            ]
          },
          "id": {
            "description": "ID of this delivery attempt.",
            "type": "string",
            "examples": [
              "atmpt_123456789012345"
            ]
          },
          "msg_id": {
            "description": "ID of the trigger event message this attempt delivered. Every attempt to deliver the same event shares this ID.",
            "type": "string",
            "examples": [
              "msg_123456789012345"
            ]
          },
          "response": {
            "description": "Response body the endpoint returned for this attempt. A long body may be truncated.",
            "type": "string",
            "examples": [
              "{\"ok\":true}"
            ]
          },
          "response_duration_ms": {
            "description": "How long the endpoint took to respond to this attempt, in milliseconds.",
            "type": "integer",
            "format": "int32",
            "examples": [
              182
            ]
          },
          "response_status_code": {
            "description": "HTTP status code the endpoint returned for this attempt.",
            "type": "integer",
            "format": "int32",
            "examples": [
              200
            ]
          },
          "response_truncated": {
            "description": "True when `response` was cut to its first 4096 bytes. Set only by ListTriggerDeliveryAttemptsByMessage and LookupTriggerDelivery, which apply that cap.",
            "type": "boolean"
          },
          "status": {
            "description": "Whether this attempt succeeded, is still in flight, failed, or was canceled. A failed delivery is retried, so FAIL on one attempt does not mean the event was never delivered — check the newest attempt for that message.",
            "$ref": "#/components/schemas/triggersTriggerDeliveryAttemptStatus",
            "examples": [
              "SUCCESS"
            ]
          },
          "timestamp": {
            "description": "When this attempt was made.",
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-09T12:34:56Z"
            ]
          },
          "trigger_type": {
            "description": "Why this attempt was made: TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_SCHEDULED for the first attempt or an automatic retry, TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_MANUAL for a retry someone started by hand.",
            "$ref": "#/components/schemas/triggersTriggerDeliveryAttemptTriggerType",
            "examples": [
              "TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_SCHEDULED"
            ]
          }
        }
      },
      "triggersTriggerDeliveryAttemptStatus": {
        "description": "The outcome of one delivery attempt.\n\n - SUCCESS: The endpoint accepted the delivery.\n - PENDING: The attempt is waiting to be sent.\n - FAIL: The attempt failed. Failed deliveries are retried.\n - SENDING: The attempt is being sent.\n - CANCELED: The attempt was canceled and will not be sent.",
        "type": "string",
        "enum": [
          "SUCCESS",
          "PENDING",
          "FAIL",
          "SENDING",
          "CANCELED"
        ]
      },
      "triggersTriggerDeliveryAttemptTriggerType": {
        "description": "Why a delivery attempt was made.\n\n - TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_SCHEDULED: The first attempt or an\nautomatic retry on the delivery schedule.\n - TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_MANUAL: A retry someone started by\nhand.",
        "type": "string",
        "enum": [
          "TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_SCHEDULED",
          "TRIGGER_DELIVERY_ATTEMPT_TRIGGER_TYPE_MANUAL"
        ]
      },
      "triggersTriggerDeliveryResendTarget": {
        "description": "One delivery to retry: a trigger event and the endpoint to deliver it to again.",
        "type": "object",
        "required": [
          "msg_id",
          "endpoint_id"
        ],
        "properties": {
          "endpoint_id": {
            "description": "ID of the delivery endpoint to deliver the event to again: `ep_` followed by 1 to 64 letters or digits.",
            "type": "string",
            "examples": [
              "ep_2yAqUuFkqbL5nXvC7HhWJRY6Gg9"
            ]
          },
          "msg_id": {
            "description": "Message ID of the trigger event to deliver again, as returned in msg_id by ListTriggerDeliveriesByEndpoint: `msg_` followed by 1 to 64 letters or digits.",
            "type": "string",
            "examples": [
              "msg_2yAqUxVq4mTt8jHZ3fWbKcN1Pd0"
            ]
          }
        }
      },
      "triggersTriggerDeliveryScope": {
        "description": "Whether a trigger delivers once per connected account or once for the whole connection.\n\nSet by the trigger, not chosen by the subscriber. A polled trigger polls with one connected\naccount's credential, so a polled trigger that is connection-scoped is reported as unavailable.\n\n - ACCOUNT: One event per subscribed connected account. For a webhook trigger,\nan event is delivered for an account only when the event's provider workspace and user match the account's; a polled\ntrigger polls each account with that account's own credential. Subscribed on a specific\nconnected account.\n - CONNECTION: One event for the whole connection, whatever accounts exist\non it. Subscribed on the connection itself, naming no account.",
        "type": "string",
        "enum": [
          "ACCOUNT",
          "CONNECTION"
        ]
      },
      "triggersTriggerDeliveryStatus": {
        "description": "The state of one trigger event's delivery to one endpoint, across all its attempts.\n\nThe values carry the enum's name as a prefix because enum values share one namespace across this\npackage, where PENDING and FAILED are already taken.\n\n - TRIGGER_DELIVERY_STATUS_DELIVERED: An attempt succeeded. No further attempt\nis made.\n - TRIGGER_DELIVERY_STATUS_PENDING: Accepted for delivery; no attempt has\nfinished yet.\n - TRIGGER_DELIVERY_STATUS_FAILED: Every scheduled attempt failed. No further\nattempt is made unless one is started by hand.\n - TRIGGER_DELIVERY_STATUS_RETRYING: An attempt failed and another is scheduled,\nat next_attempt_at.",
        "type": "string",
        "enum": [
          "TRIGGER_DELIVERY_STATUS_DELIVERED",
          "TRIGGER_DELIVERY_STATUS_PENDING",
          "TRIGGER_DELIVERY_STATUS_FAILED",
          "TRIGGER_DELIVERY_STATUS_RETRYING"
        ]
      },
      "triggersTriggerIngressEndpoint": {
        "description": "The webhook URL a provider sends a connection's events to, and the state of the secret those\nevents are signed with.\n\nThis message never carries the signing secret itself: masked_signing_secret shows at most its\nlast four characters, so you can tell which secret is stored. The only response that returns a\nsecret in plaintext is GenerateTriggerSigningSecret's, once, for a secret Scalekit generates.",
        "type": "object",
        "properties": {
          "connection_id": {
            "description": "ID of the connection this webhook URL belongs to.",
            "type": "string",
            "examples": [
              "conn_28128748834787840"
            ]
          },
          "id": {
            "description": "Unique identifier of the connection's webhook endpoint.",
            "type": "string",
            "examples": [
              "tie_28128748834787840"
            ]
          },
          "masked_signing_secret": {
            "description": "The stored secret with all but its last four characters replaced, or every character replaced for a secret of 8 characters or fewer. Present only when one is configured. Enough to compare against the secret the provider's app configuration shows, and never enough to sign with.",
            "type": "string",
            "examples": [
              "************************a4f9"
            ]
          },
          "previous_signing_secret_expires_at": {
            "description": "When the previous secret stops being accepted even if the rotation is never confirmed: 24 hours after the rotation started. Absent when no rotation is in progress.",
            "type": "string",
            "format": "date-time"
          },
          "rotation_in_progress": {
            "description": "Whether the previous signing secret is still accepted alongside the current one. True from the moment a different secret replaces a stored one until the rotation is confirmed, or until previous_signing_secret_expires_at passes.",
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "signing_secret_configured": {
            "description": "Whether a signing secret is stored. While false, every event sent to the URL is answered with 503 so the provider retries it, and the provider's own URL verification fails.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "signing_secret_rotation_id": {
            "description": "Identifies the latest signing-secret rotation; it increases by one each time a rotation starts. Zero when none has ever started. Pass this value to ConfirmTriggerSigningSecretRotation to confirm this specific rotation. A value naming a rotation that a newer one has since replaced is refused rather than confirming the wrong rotation.",
            "type": "string",
            "format": "int64",
            "examples": [
              3
            ]
          },
          "url": {
            "description": "The URL to paste into the provider's app configuration as the event destination. It is built on your environment's domain, using its custom domain when one is set, and ends in a random token unique to this connection, so treat it as confidential. Returned whether or not a signing secret has been set. The URL accepts request bodies up to 1 MB and answers a larger one with 413. Until a signing secret is set it answers events with 503, so the provider retries them; an event that fails signature verification is answered with 400.",
            "type": "string",
            "examples": [
              "https://acme.scalekit.dev/triggers/v1/kq3T9vX2bL8mN4pR7sW1yZ"
            ]
          }
        }
      },
      "triggersTriggerMode": {
        "description": "How a trigger detects that something happened.\n\n - WEBHOOK: The provider posts to a Scalekit URL when the event occurs.\n - POLL: Scalekit walks the provider's list on a cadence.",
        "type": "string",
        "enum": [
          "WEBHOOK",
          "POLL"
        ]
      },
      "triggersTriggerPlatformCredentials": {
        "description": "Whether a trigger works on a connection that uses Scalekit's shared provider app.\n\n - SUPPORTED: The trigger works on Scalekit's shared provider app as well\nas on the customer's own app.\n - UNSUPPORTED: The trigger needs the customer's own provider app on the connection\n— for example because a webhook URL is registered against the app, and the shared app has only one.",
        "type": "string",
        "enum": [
          "SUPPORTED",
          "UNSUPPORTED"
        ]
      },
      "triggersTriggerPollErrorCode": {
        "description": "Why a poll subscription's most recent run failed.\n\n - RATE_LIMITED: The provider asked Scalekit to slow down. Polling resumes\nafter backoff_until.\n - CREDENTIAL_REVOKED: The connected account's authorization was revoked or\nhas expired. Reconnect the account.\n - INVALID_CONFIGURATION: The subscription's configuration does not produce\na valid request for this trigger. Update the subscription's configuration.\n - PROVIDER_ERROR: The provider returned an error. Retried on the next run.\n - DELIVERY_FAILED: Events could not be handed to the delivery service. Retried\non the next run.\n - TIMED_OUT: The run timed out before it finished. Retried on the next run.\n - POLL_FAILED: The run failed for a reason none of the other codes describes.\nRetried on the next run.",
        "type": "string",
        "enum": [
          "RATE_LIMITED",
          "CREDENTIAL_REVOKED",
          "INVALID_CONFIGURATION",
          "PROVIDER_ERROR",
          "DELIVERY_FAILED",
          "TIMED_OUT",
          "POLL_FAILED"
        ]
      },
      "triggersTriggerPollState": {
        "description": "The state of a poll subscription's feed, as of its most recent run.\n\nRead from the feed's own stored state on every request rather than derived, so a feed that is\nfailing, rate limited, or held off is visible without looking at logs. A subscription whose\nstatus is ACTIVE can still be failing every run; this is where that shows.",
        "type": "object",
        "properties": {
          "backoff_until": {
            "description": "Polling is held off until this time, because the provider asked Scalekit to slow down or a run failed in a way retrying cannot fix. Absent when no hold-off has been recorded. A time in the past means the hold-off has ended and the next scheduled run polls again.",
            "type": "string",
            "format": "date-time"
          },
          "consecutive_failures": {
            "description": "How many runs in a row have failed. Zero after any successful run.",
            "type": "integer",
            "format": "int64"
          },
          "last_error": {
            "description": "A short, human-readable explanation of why the most recent run failed and what happens next. Empty when the most recent run succeeded or no run has happened yet. Chosen from a fixed set of messages by last_error_code and never contains the provider's response. The wording can change: match on last_error_code, not on this text.",
            "type": "string",
            "examples": [
              "The provider is rate-limiting requests. Polling resumes automatically after a backoff."
            ]
          },
          "last_error_code": {
            "description": "Why the most recent run failed, as a stable code to branch on. TRIGGER_POLL_ERROR_CODE_UNSPECIFIED when the most recent run succeeded or no run has happened yet. CREDENTIAL_REVOKED and INVALID_CONFIGURATION need a change from the customer before polling can succeed; every other code is retried automatically.",
            "$ref": "#/components/schemas/triggersTriggerPollErrorCode",
            "examples": [
              "RATE_LIMITED"
            ]
          },
          "last_run_at": {
            "description": "When Scalekit last polled the provider for this subscription, whether or not the run succeeded. Absent until the first run. A value far older than the effective interval means the feed has stopped running.",
            "type": "string",
            "format": "date-time"
          },
          "watermark_updated_at": {
            "description": "When the feed's position last moved forward — the last time a run found and delivered newer events. A run that finds nothing new leaves it unchanged.",
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "triggersTriggerRefusalCode": {
        "description": "Which connection-level rule made a trigger unavailable, as a stable code a client can branch on\ninstead of parsing the human-readable reason.\n\n - SHARED_APP: The connection uses Scalekit's shared provider app and the\ntrigger needs the customer's own.\n - POLL_CONNECTION_SCOPE: The trigger is polled and connection-scoped, which\nthe poll path does not support.",
        "type": "string",
        "enum": [
          "SHARED_APP",
          "POLL_CONNECTION_SCOPE"
        ]
      },
      "triggersTriggerSubscription": {
        "description": "A subscription of one connected account, or of a whole connection, to one trigger.",
        "type": "object",
        "properties": {
          "account_health": {
            "description": "How the subscribed account stands for this trigger. AWAITING_CONFIRMATION means Scalekit cannot route this trigger's events to the account yet, so the subscription will not fire until the account's user reconnects it. Absent for connection-scoped subscriptions.",
            "$ref": "#/components/schemas/triggersAccountHealthState",
            "examples": [
              "READY"
            ]
          },
          "config": {
            "description": "The subscription's filter values, keyed by the trigger's config_fields keys. Keys are returned exactly as stored; send them back without changing their case.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "examples": [
              {
                "channel": "C0123456789"
              }
            ]
          },
          "connected_account_id": {
            "description": "ID of the subscribed connected account. Empty for a connection-scoped subscription.",
            "type": "string",
            "examples": [
              "ca_123456789012345"
            ]
          },
          "connected_account_identifier": {
            "description": "The identifier the connected account was created with, such as your app's user ID or the user's email address, so a client can label the subscription without fetching every account separately. Empty for a connection-scoped subscription, and empty when the account has no identifier recorded — fall back to connected_account_id rather than showing a blank.",
            "type": "string",
            "examples": [
              "user_123"
            ]
          },
          "connection_id": {
            "description": "ID of the connection the subscription belongs to.",
            "type": "string",
            "examples": [
              "conn_123456789012345"
            ]
          },
          "created_at": {
            "description": "When the subscription was created. Returned so a list can be ordered or explained by age without a second lookup.",
            "type": "string",
            "format": "date-time"
          },
          "delivery_scope": {
            "description": "Whether this subscription receives one event per connected account or one event for the whole connection. A connection-scoped subscription carries no connected_account_id — the connection is the only recipient.",
            "$ref": "#/components/schemas/triggersTriggerDeliveryScope",
            "examples": [
              "ACCOUNT"
            ]
          },
          "effective_interval_seconds": {
            "description": "The polling interval, in seconds, the subscription actually runs at. Larger than requested_interval_seconds when the environment's polling budget is shared across many polled subscriptions; the subscription's status is then THROTTLED. Zero for a webhook trigger.",
            "type": "integer",
            "format": "int32",
            "examples": [
              60
            ]
          },
          "id": {
            "description": "Unique identifier of the trigger subscription.",
            "type": "string",
            "examples": [
              "trgs_123456789012345"
            ]
          },
          "poll_state": {
            "description": "How a POLL subscription's feed is doing: when it last ran, why the last run failed, and whether polling is held off. Absent for a WEBHOOK subscription, which is never polled.",
            "$ref": "#/components/schemas/triggersTriggerPollState"
          },
          "provider": {
            "description": "The provider the trigger belongs to.",
            "type": "string",
            "examples": [
              "slack"
            ]
          },
          "requested_interval_seconds": {
            "description": "The polling interval, in seconds, the subscription asked for, or the trigger's default when it did not set one. Returned next to effective_interval_seconds so a subscription running slower than requested is visible. Zero for a webhook trigger.",
            "type": "integer",
            "format": "int32",
            "examples": [
              60
            ]
          },
          "status": {
            "description": "Whether the subscription is delivering. ACTIVE — delivering. THROTTLED — delivering, but polling slower than requested; compare requested_interval_seconds with effective_interval_seconds. PAUSED — stopped by the customer. PAUSED_CREDENTIAL — stopped because the account's credential no longer works.",
            "$ref": "#/components/schemas/triggersTriggerSubscriptionStatus",
            "examples": [
              "ACTIVE"
            ]
          },
          "trigger_name": {
            "description": "Name of the subscribed trigger, as returned by ListAvailableTriggers.",
            "type": "string",
            "examples": [
              "slack_message_posted"
            ]
          }
        }
      },
      "triggersTriggerSubscriptionStatus": {
        "description": "Why a subscription is or is not currently delivering.\n\n - ACTIVE: Delivering. For a polled trigger, at the requested interval.\n - THROTTLED: Running slower than requested, not stopped. Still delivering.\n - PAUSED: Stopped by the customer.\n - PAUSED_CREDENTIAL: Stopped because the account's credential no longer works.\nDistinct from PAUSED so the two have distinguishable explanations for missing events.",
        "type": "string",
        "enum": [
          "ACTIVE",
          "THROTTLED",
          "PAUSED",
          "PAUSED_CREDENTIAL"
        ]
      },
      "triggersTriggerUsageBucket": {
        "description": "The size of each entry in a trigger usage response.\n\n - TRIGGER_USAGE_BUCKET_DAY: One entry per UTC calendar day, in days. Returned\nfor period 7d and 30d.\n - TRIGGER_USAGE_BUCKET_HOUR: One entry per UTC clock hour, in hours. Returned\nfor period 24h.",
        "type": "string",
        "enum": [
          "TRIGGER_USAGE_BUCKET_DAY",
          "TRIGGER_USAGE_BUCKET_HOUR"
        ]
      },
      "triggersTriggerUsageDay": {
        "description": "Trigger deliveries metered for an environment on one UTC calendar day.",
        "type": "object",
        "properties": {
          "date": {
            "description": "The UTC calendar date, as YYYY-MM-DD.",
            "type": "string",
            "examples": [
              "2026-10-08"
            ]
          },
          "units": {
            "description": "Trigger deliveries metered for this environment on this day: one for each trigger event sent to one receiving endpoint. Always greater than zero; a day with none is left out of the response.",
            "type": "string",
            "format": "int64",
            "examples": [
              447
            ]
          }
        }
      },
      "triggersTriggerUsageHour": {
        "description": "Trigger deliveries metered for an environment in one UTC clock hour.",
        "type": "object",
        "properties": {
          "start": {
            "description": "The start of the UTC clock hour, as an RFC 3339 timestamp in UTC (`Z`) with zero minutes and seconds. The hour runs from `start` up to, not including, `start` plus one hour.",
            "type": "string",
            "examples": [
              "2026-10-14T17:00:00Z"
            ]
          },
          "units": {
            "description": "Trigger deliveries metered for this environment in this hour: one for each trigger event sent to one receiving endpoint. Always greater than zero; an hour with none is left out of the response.",
            "type": "string",
            "format": "int64",
            "examples": [
              38
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://$SCALEKIT_ENVIRONMENT_URL/oauth/token",
            "scopes": {
              "": "No scope required for client credentials flow"
            }
          }
        }
      }
    }
  },
  "x-scalar-environments": {
    "production": {
      "variables": {
        "SCALEKIT_ENVIRONMENT_URL": {
          "default": "https://$SCALEKIT_ENVIRONMENT_URL",
          "description": "yourapp.scalekit.com"
        }
      }
    },
    "staging": {
      "variables": {
        "SCALEKIT_ENVIRONMENT_URL": {
          "default": "https://$SCALEKIT_ENVIRONMENT_URL",
          "description": "yourapp.scalekit.dev"
        }
      }
    }
  },
  "x-scalar-active-environment": "staging",
  "x-scalekit-docs-operation-rank": {
    "default": 0,
    "path-segments": [
      {
        "match": ":external",
        "rank": 1
      },
      {
        "match": ":search",
        "rank": 2
      }
    ]
  }
}