# GENERATED FILE. Do not edit.
#
# Projected from the Zod MCP tool registry in product/mcp/gtm.mcp.
# Regenerate:  cd product/mcp/gtm.mcp && pnpm openapi:public
# Verify:      cd product/mcp/gtm.mcp && pnpm openapi:public:check
openapi: 3.0.3
info:
  title: "GTM API public contract: gtm.service.id"
  description: |-
    Identity, access and money: users, teams and members, API keys, OAuth clients and authorizations, billing products, subscriptions, transactions and payment methods, notifications, TLS certificates and support requests.

    GENERATED. This document is projected from the Zod MCP tool registry in `product/mcp/gtm.mcp` (one tool per public endpoint, 1:1). Do not edit it by hand; edit the tool definition and regenerate with `pnpm openapi:public`.

    Surface: the public `/api` contract of `gtm.service.id`, 86 operations. This is the only OpenAPI document the platform publishes. Internal (`/internal`) and health endpoints are deliberately absent: they are not part of any contract, they can change without notice, and the service source is their only description.

    Conventions:
    - Auth is a bearer JWT, optionally narrowed by the `Team-SID` header.
    - Every success body is an MCP envelope: `success: true` plus one typed `operation` shape (`search`, `get`, `create`, `update`, `delete`, `metrics`, `group_by`, `action`), and a `meta` block with `trace_id` for support.
    - Every failure is the same `McpError` envelope with a code from a fixed 16-code taxonomy, so a client maps errors once.
    - Lists page with `page_size` (0 to 500, default 50) plus an opaque forward `cursor`; `page_size: 0` returns counts only.
    - On `GET` and `DELETE`, object-valued query parameters (`filter`, `sort`) travel as JSON text and array-valued ones repeat as `name[]=value`.
    - The MCP-only `_meta` field (usage analytics) never reaches the backend and is not part of this contract.
  version: "1.0"
  contact:
    name: GTM API
    url: https://gtm-api.com
    email: support@gtm-api.com
  license:
    name: Proprietary
    url: https://gtm-api.com/license
servers:
  - url: https://app.gtm-api.com/id/v4
    description: Production, through the app.gtm-api.com gateway
security:
  - BearerJwt: []
    TeamSid: []
tags:
  - name: account_shares
    description: Registry package `mcp.id/account_shares`, served on MCP mount `id.access`.
  - name: api_keys
    description: Registry package `mcp.id/api_keys`, served on MCP mount `id.access`.
  - name: api_requests
    description: Registry package `mcp.id/api_requests`, served on MCP mount `id.platform`.
  - name: billing_payment_methods
    description: Registry package `mcp.id/billing_payment_methods`, served on MCP mount `id.billing`.
  - name: billing_products
    description: Registry package `mcp.id/billing_products`, served on MCP mount `id.billing`.
  - name: billing_subscriptions
    description: Registry package `mcp.id/billing_subscriptions`, served on MCP mount `id.billing`.
  - name: billing_transactions
    description: Registry package `mcp.id/billing_transactions`, served on MCP mount `id.billing`.
  - name: email_account_directory
    description: Registry package `mcp.id/email_account_directory`, served on MCP mount `email.accounts`.
  - name: email_boxes
    description: Registry package `mcp.id/email_boxes`, served on MCP mount `id.billing`.
  - name: media_uploads
    description: Registry package `mcp.id/media_uploads`, served on MCP mount `id.platform`.
  - name: notifications
    description: Registry package `mcp.id/notifications`, served on MCP mount `id.platform`.
  - name: oauth_authorizations
    description: Registry package `mcp.id/oauth_authorizations`, served on MCP mount `id.access`.
  - name: oauth_clients
    description: Registry package `mcp.id/oauth_clients`, served on MCP mount `id.access`.
  - name: sessions
    description: Registry package `mcp.id/sessions`, served on MCP mount `id.identity`.
  - name: ssl_certificates
    description: Registry package `mcp.id/ssl_certificates`, served on MCP mount `id.platform`.
  - name: support_requests
    description: Registry package `mcp.id/support_requests`, served on MCP mount `id.platform`.
  - name: team_members
    description: Registry package `mcp.id/team_members`, served on MCP mount `id.identity`.
  - name: teams
    description: Registry package `mcp.id/teams`, served on MCP mount `id.identity`.
  - name: users
    description: Registry package `mcp.id/users`, served on MCP mount `id.identity`.
paths:
  /api/account-shares:
    post:
      operationId: create_account_share
      summary: Lend an account to another workspace
      description: |-
        Lend ONE of your connected accounts to another workspace, temporarily and revocably. This is a loan, not a handover: permanent ownership transfer has no MCP tool at all. Target exactly one of to_email (resolved to that user's working team) or to_team_sid; neither, both, a bad email or a self-target is 422. account_sid is prefix agnostic (ln_ac_, em_ac_); `channel` says which service owns it. ALWAYS ASYNC: returns 201 with status pending, and the loan has NOT started. Poll search_account_shares with filter { sid: { eq } } until status is active (the holder can work) or failed (read failure_reason); rolling_back means it is being undone, so do not re-issue. holder_over_slot true means the copy landed in the holder's subscription hold and they cannot work until they upgrade; a share never fails on slots. One row is one account with no bulk arm, so N accounts is N calls. planned_return_at only emails the owner a recall link; there is no auto return. Needs can_manage_account_shares.

        Contract:
        - MCP tool `create_account_share`, registry package `mcp.id/account_shares`, mount `id.access`.
        - Operation `create`, response envelope `create`.
        - Flags: none.
      tags:
        - account_shares
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountShareRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateAccountShareResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_account_share
      x-gtm-mcp-mount: id.access
      x-gtm-entity: account_shares
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/account-shares/list-received:
    post:
      operationId: list_received_account_shares
      summary: List received account shares
      description: |-
        List the account shares your team RECEIVED: accounts on loan TO you. Reach for this whenever the question is about a BORROWED account (what did we borrow, from whom, until when, is it still active), and for search_account_shares when it is about an account your own team owns and lent out. Registered as an action route but it is a plain read, with the same envelope, filters and sorts as search. It is also the holder's only programmatic arrival signal, because the domain events fan out to the owner team alone: poll filter { status: { eq: "active" } } sorted by created_at asc. Rows belong to the owner tenant, so created_by and ended_by arrive with permissions emptied and the trace id nulled. include:["counterparty_team"] names the other workspace; no counts block, and page_size 0 returns pagination.total_count alone. Needs can_view_account_shares.

        Contract:
        - MCP tool `list_received_account_shares`, registry package `mcp.id/account_shares`, mount `id.access`.
        - Operation `action`, response envelope `search`.
        - Flags: read only.
      tags:
        - account_shares
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ListReceivedAccountSharesRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListReceivedAccountSharesResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: list_received_account_shares
      x-gtm-mcp-mount: id.access
      x-gtm-entity: account_shares
      x-gtm-operation: action
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/account-shares/recall:
    post:
      operationId: recall_account_share
      summary: Recall a lent-out account
      description: |-
        Take a lent-out account back. Owner side, no holder consent. Target EXACTLY ONE of sid (ac_sh_) or filter; neither or both is 422 on sid_or_filter. FILTER MODE fans out over the loans you ISSUED, the server FORCES status to active so your filter can only narrow the set, and it drains INLINE at most 100 shares per call, minting no mass-action row. It also requires confirmation_count equal to the active-pinned pagination.total_count search_account_shares reports for the same filter; anything else is 409 confirmation_count_mismatch. Single-sid mode ignores it. ASYNC: the call stamps status closing and a driver does the teardown, so closing_count means shares that STARTED closing, never shares recalled; poll status to recalled. NOT atomic: a mid-batch error returns no counters and earlier shares stay closing, so re-query search rather than retrying the same body. closing_count below total_matched leaves a remainder; every next call needs a FRESH count. Needs can_manage_account_shares.

        Contract:
        - MCP tool `recall_account_share`, registry package `mcp.id/account_shares`, mount `id.access`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API; mass action: this verb's own request accepts a filter or targets[] set, which the owning service drains.
      tags:
        - account_shares
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RecallAccountShareRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecallAccountShareResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: recall_account_share
      x-gtm-mcp-mount: id.access
      x-gtm-entity: account_shares
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: true
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/account-shares/return:
    post:
      operationId: return_account_share
      summary: Return a borrowed account
      description: |-
        Give a borrowed account back early. Holder side. Same shape as recall_account_share: EXACTLY ONE of sid (ac_sh_) or filter, filter mode server-pinned to status active, drained INLINE at most 100 shares per call with no mass-action row minted, and confirmation_count required with filter and matched against the active-pinned pagination.total_count of list_received_account_shares (409 confirmation_count_mismatch otherwise). The difference is the side: the filter resolves over the loans you RECEIVED, and a share you do not hold is 403 not_share_holder. ASYNC: it stamps status closing, then the driver tears the holder copy down and un-parks the owner, so closing_count counts shares that STARTED closing; poll status to returned. Not atomic, and the same remainder and recount rule as recall. Deleting the borrowed copy on the channel has the same effect, ending the loan with end_reason holder_deleted_copy. Needs can_manage_account_shares.

        Contract:
        - MCP tool `return_account_share`, registry package `mcp.id/account_shares`, mount `id.access`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API; mass action: this verb's own request accepts a filter or targets[] set, which the owning service drains.
      tags:
        - account_shares
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReturnAccountShareRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnAccountShareResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: return_account_share
      x-gtm-mcp-mount: id.access
      x-gtm-entity: account_shares
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: true
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/account-shares/search:
    post:
      operationId: search_account_shares
      summary: Search issued account shares
      description: |-
        List the account shares your team ISSUED: accounts you lent OUT to another workspace. Sharing is TEMPORARY and revocable; permanent ownership transfer is a web-app-only flow with no MCP tool, so never offer this as a way to give an account away. This is also the polling surface, since there is no get tool and no /{sid} route: read one loan with filter { sid: { eq } } and watch status until active (the holder can work), failed (it never started, read failure_reason), or terminal recalled / returned. filter.owner_account_sid answers 'is this account lent out and to whom'; holder_over_slot finds loans that landed with no free slot. The number recall_account_share has to confirm is pagination.total_count here, NOT total_matched; page_size 0 returns it with no rows. No include[], no counts block, no free-text q. Needs can_view_account_shares.

        Contract:
        - MCP tool `search_account_shares`, registry package `mcp.id/account_shares`, mount `id.access`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - account_shares
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchAccountSharesRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchAccountSharesResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_account_shares
      x-gtm-mcp-mount: id.access
      x-gtm-entity: account_shares
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/api-keys:
    post:
      operationId: create_api_key
      summary: Create API key
      description: |-
        Issue a new API key and return the full secret in the create envelope's plaintext_token EXACTLY ONCE. It is unrecoverable, so hand it to the user immediately and never log or echo it; if lost, rotate. BOTH grant axes are clamped to the ISSUER's own current authority (403, reason grant_exceeds_ceiling): permissions must sit inside the caller's token set ('*' only for an unrestricted issuer; on delegation, inside the parent key's set), and account_sids inside the caller's account slice - a sliced caller cannot pass null ("all accounts") and must send an explicit list within their slice. Verify re-intersects both axes with the issuer's CURRENT authority, so narrowing the issuer narrows every key they minted. Default expires_at = now + 3 years; pass null for a perpetual key. Natural key (team_sid, name) among non-revoked keys → a duplicate returns already_exists with the existing key (and NO secret).

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/api_keys`, surface api).
        - Operation `create`, response envelope `create`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - api_keys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateApiKeyRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateApiKeyResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_api_key
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/api-keys/metrics:
    post:
      operationId: get_api_keys_metrics
      summary: API key metrics
      description: |-
        Period-bound counts of the team's keys by status, plus issuance / expiry tallies inside the window (created_in_period, expired_in_period). Requires period {from, to}. Optional filter. Counts key rows, not key traffic.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/api_keys`, surface api).
        - Operation `metrics`, response envelope `metrics`.
        - Flags: read only.
      tags:
        - api_keys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetApiKeysMetricsRequest"
      responses:
        "200":
          description: "`metrics` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetApiKeysMetricsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_api_keys_metrics
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: metrics
      x-gtm-envelope: metrics
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/api-keys/search:
    post:
      operationId: search_api_keys
      summary: Search API keys
      description: |-
        List the team's API keys for an access audit: which keys exist, what each can do (permissions), their status, when each was last_used_at and when each expires. Filter by status for live vs dead keys, by last_used_at.lt for stale keys to revoke at offboarding, or by expires_at for keys expiring soon. The secret is never returned (only token_prefix + token_last4). include:["metrics"] attaches per-key counts; page_size:0 returns counts only.

        Contract:
        - MCP tool `search_api_keys`, registry package `mcp.id/api_keys`, mount `id.access`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - api_keys
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchApiKeysRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchApiKeysResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_api_keys
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/api-keys/{sid}:
    get:
      operationId: get_api_key
      summary: Get API key
      description: |-
        Fetch a single API key by sid, with optional metrics include. Returns token_prefix + token_last4 for display; the secret is unrecoverable (a new one is minted by the rotate route of the REST API or in Settings, never through a tool).

        Contract:
        - MCP tool `get_api_key`, registry package `mcp.id/api_keys`, mount `id.access`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - api_keys
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_ak_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - metrics
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetApiKeyResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_api_key
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    patch:
      operationId: update_api_key
      summary: Update API key
      description: |-
        Partial update of name / permissions / account_sids (the key's identity and secret are untouched; use rotate_api_key to change the secret). Each list is a FULL replacement, clamped to the STORED issuer's current authority on its axis (403, reason grant_exceeds_ceiling): permissions inside their token set, account_sids inside their slice (null = all accounts, grantable only under an unrestricted issuer slice). At least one field is required. A change takes effect at once: id tells every channel service to forget the key's cached verdict (a peer the fan-out cannot reach falls back to its 5-minute cache).

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/api_keys`, surface api).
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - api_keys
      parameters:
        - name: sid
          in: path
          required: true
          description: API key sid (id_ak_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_ak_
            description: API key sid (id_ak_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateApiKeyRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateApiKeyResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_api_key
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
    delete:
      operationId: delete_api_key
      summary: Revoke API key
      description: |-
        Revoke a key (simple soft-delete): status=revoked, deleted_at set. The key stops verifying at once: id tells every channel service to forget its cached verdict (a peer the fan-out cannot reach falls back to its 5-minute cache). Irreversible: a revoked key never re-activates; issue a fresh one. Idempotent: re-deleting → already_deleted.

        Contract:
        - MCP tool `delete_api_key`, registry package `mcp.id/api_keys`, mount `id.access`.
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - api_keys
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_ak_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteApiKeyResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_api_key
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/api-keys/{sid}/rotate:
    post:
      operationId: rotate_api_key
      summary: Rotate API key
      description: |-
        Swap the key's secret IN PLACE and return the new plaintext in result.plaintext_token EXACTLY ONCE: hand it to the user, never log it, unrecoverable. The key's sid / name / permissions / expires_at are unchanged. The previous secret stays valid until result.previous_token_expires_at (now + grace_seconds, default 24h) so the agent can update config without downtime. Use when a secret leaks or before offboarding. NOT idempotent: each call mints a brand-new secret. Rotating a revoked/expired key → 409.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/api_keys`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - api_keys
      parameters:
        - name: sid
          in: path
          required: true
          description: API key sid (id_ak_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_ak_
            description: API key sid (id_ak_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RotateApiKeyRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RotateApiKeyResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: rotate_api_key
      x-gtm-mcp-mount: id.access
      x-gtm-entity: api_keys
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/api-requests/metrics:
    post:
      operationId: get_api_request_metrics
      summary: API request metrics
      description: |-
        Period-bound totals of the team's external API requests, merged across the answering services: total_count, error_count and the 2xx/3xx/4xx/5xx split in aggregated.counts; error_rate, avg_duration_ms, first/last_occurred_at in aggregated.metrics. Requires period {from, to} (ISO 8601 UTC, half-open, at most 92 days). Optional group_by splits the same numbers per key: client_sid ("how much does each agent call", groups carry the client name), route or entity ("which tools"), status_family, service, surface (occurred_hour / occurred_day exist too but bucket is the better time axis). Optional bucket (hour | day) cuts the window into consecutive UTC buckets, series.points[] one per bucket over the whole window with zeros filled, each carrying its own counts and its own group_by split: "requests per day by type" is group_by entity + bucket day in one call. Use to answer "how many calls this week and how many failed" in one round-trip instead of paging the log. aggregated.counts.sources says which services answered.

        Contract:
        - MCP tool `get_api_request_metrics`, registry package `mcp.id/api_requests`, mount `id.platform`.
        - Operation `metrics`, response envelope `metrics`.
        - Flags: read only.
      tags:
        - api_requests
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetApiRequestMetricsRequest"
      responses:
        "200":
          description: "`metrics` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetApiRequestMetricsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_api_request_metrics
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: api_requests
      x-gtm-operation: metrics
      x-gtm-envelope: metrics
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/api-requests/search:
    post:
      operationId: search_api_requests
      summary: Search API requests
      description: |-
        List the team's external API requests newest first: every call made with an api key or an OAuth client (your own calls included), as logged by the service that answered it, merged across id, linkedin and orchestration. One row per request: the client (key or OAuth client, with its name), the route and entity, the HTTP status and its family, the typed error it failed with (error_code, error_reason, error_cause), the account it named, the duration, the trace id. Use for "what did our agents do", "show the failing requests since noon" (filter status_family in [4xx,5xx]), "why are these all 429" (filter error_cause: a paused account is not a spent daily limit), "what did the n8n client call" (filter client_sid), or one MCP turn (filter trace_id). page_size 0 counts only; the cursor is a keyset merged across services. counts.sources says which services answered; a service marked error contributed nothing. Not LinkedIn activity (that is the account activity log) and not a quota: the log counts, it never limits.

        Contract:
        - MCP tool `search_api_requests`, registry package `mcp.id/api_requests`, mount `id.platform`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - api_requests
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchApiRequestsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchApiRequestsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_api_requests
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: api_requests
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-payment-methods:
    get:
      operationId: list_billing_payment_methods
      summary: List payment methods
      description: |-
        List the saved cards / PayPal / wallets for the active workspace's paying user (proxied live from Paddle). The list is re-sorted so the billing card is items[0]; is_default:true is the card that last billed the workspace, so answer 'which card am I paying with' by reading it. Cards may be listed even with no applied subscription; empty if the user has no Paddle customer. Brand + last4 + expiry only (PCI). Requires billing.view.

        Contract:
        - MCP tool `list_billing_payment_methods`, registry package `mcp.id/billing_payment_methods`, mount `id.billing`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - billing_payment_methods
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListBillingPaymentMethodsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: list_billing_payment_methods
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_payment_methods
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-payment-methods/get-add-link:
    post:
      operationId: get_billing_payment_method_add_link
      summary: Get add-card link
      description: |-
        Return a temporary Paddle Customer Portal deep link to add or replace a card, the ONLY way to add one: Paddle has no add-card API, the user enters the card on Paddle's hosted page. Without subscription_sid it is for the workspace's applied subscription (no_billing_account if none). With it, for that subscription: 403 not_subscription_owner unless it is the caller's or applied to this workspace, 422 if invoiced, 409 with no Paddle subscription. Never cached. Requires billing.manage.

        Contract:
        - MCP tool `get_billing_payment_method_add_link`, registry package `mcp.id/billing_payment_methods`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - billing_payment_methods
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetBillingPaymentMethodAddLinkRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingPaymentMethodAddLinkResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_payment_method_add_link
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_payment_methods
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-payment-methods/{sid}:
    delete:
      operationId: delete_billing_payment_method
      summary: Delete payment method
      description: |-
        Remove a saved payment method: this only takes it off the paying user's saved list in Paddle. A method a live subscription uses is refused (409 conflict, payment_method_in_use) until that subscription is moved to another card via get_billing_payment_method_add_link: always the case for is_default:true while the plan bills it. A non-default card can be refused too, when it pays another subscription of the same payer (another workspace or a floating one). Idempotent. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_payment_methods`, surface api).
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_payment_methods
      parameters:
        - name: sid
          in: path
          required: true
          description: "Paddle payment-method id (paymtd_…): a raw Paddle id, not an 18-char platform sid."
          schema:
            type: string
            pattern: ^paymtd_
            description: "Paddle payment-method id (paymtd_…): a raw Paddle id, not an 18-char platform sid."
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteBillingPaymentMethodResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_billing_payment_method
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_payment_methods
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-products/search:
    post:
      operationId: search_billing_products
      summary: Search billing products
      description: |-
        List the Paddle-synced product catalog (the base plan, add-ons and any credits packs) with filtering, sorting and cursor pagination. Filter by type to split plan, add-on and credits_pack, is_active for the live catalog, or q for an infix match over name/slug. Each row carries the per-unit limits grant. Read-only: the catalog is authored in Paddle, never here. page_size:0 returns counts only.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_products`, surface api).
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - billing_products
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchBillingProductsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchBillingProductsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_billing_products
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_products
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/create-checkout:
    post:
      operationId: create_billing_subscription_checkout
      summary: Create subscription checkout
      description: |-
        Start a self-serve purchase of a subscription. DANGEROUS (charges money): it pre-creates a billed Paddle transaction and returns a hosted checkout_url the buyer pays in the Paddle overlay (server-side preview→commit gate applies). Resolves the bracket price for the requested slot count, optionally applies to team_sid on activation (omit to buy floating), and can bundle add-ons in the same checkout. The real subscription row is born on the billing-subscriptions.activated webhook; poll get/search afterwards. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateBillingSubscriptionCheckoutRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateBillingSubscriptionCheckoutResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_billing_subscription_checkout
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/billing-subscriptions/search:
    post:
      operationId: search_billing_subscriptions
      summary: Search billing subscriptions
      description: |-
        List the caller's billing subscriptions: the ones they bought (owner = caller, including floating subscriptions applied to no team) plus the one applied to a team they can read. Filter by status, team_sid:{is_null:true} for floating, paddle_subscription_id:{is_null:true} for the internal sentinels (free/partner), or current_period_ends_at for expiry windows. include price / product / team / latest_transactions to hydrate context. page_size:0 returns counts only.

        Contract:
        - MCP tool `search_billing_subscriptions`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - billing_subscriptions
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchBillingSubscriptionsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchBillingSubscriptionsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_billing_subscriptions
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}:
    get:
      operationId: get_billing_subscription
      summary: Get billing subscription
      description: |-
        Fetch one billing subscription by sid, with optional includes (price, product, team, latest_transactions). 404 outside the search's scope: the caller's own and the workspace's applied one.

        Contract:
        - MCP tool `get_billing_subscription`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/billing-subscriptions/{sid}/add-addon:
    post:
      operationId: add_billing_subscription_addon
      summary: Add subscription add-on
      description: |-
        Add a recurring add-on item to the SAME subscription (one Paddle PATCH, one prorated charge). DANGEROUS: money moves; server-side confirm gate applies. The proration rides the subscription's own next invoice (prorated_next_billing_period) so the buyer sees one charge on one date, except while a cancel or pause is scheduled, where Paddle refuses a next-period mode and the prorated amount is charged immediately instead. result.proration_mode reports which of the two was used. Not idempotent: every call buys quantity more units. When Paddle's answer to the change is lost, or it answers 5xx, the service reads the subscription back: the call succeeds when Paddle carries the change, and anything else is 409 billing_change_unconfirmed, which is not a retry: read the subscription again before buying more. Requires billing.manage.

        Contract:
        - MCP tool `add_billing_subscription_addon`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddBillingSubscriptionAddonRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddBillingSubscriptionAddonResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: add_billing_subscription_addon
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/apply:
    post:
      operationId: apply_billing_subscription
      summary: Apply subscription to team
      description: |-
        Apply a floating subscription (owned by the caller) to a team, activating its slots + limits there. Owner-only. DANGEROUS state change (server-side confirm gate); rejects with 409 if the team already has a live applied subscription or is soft-deleted. No charge. Requires billing.manage.

        Contract:
        - MCP tool `apply_billing_subscription`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApplyBillingSubscriptionRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApplyBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: apply_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/cancel:
    post:
      operationId: cancel_billing_subscription
      summary: Cancel subscription
      description: |-
        Cancel the subscription at the end of the current period (terminal). DANGEROUS: the team loses capacity when the period ends, though data is retained and there is no immediate charge or refund. Server-side confirm gate applies. There is no delete verb; cancel is the canonical termination. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CancelBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: cancel_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/change:
    post:
      operationId: change_billing_subscription
      summary: Change subscription
      description: |-
        Change the plan's quantity or bracket price: an UPGRADE charges the owner's card immediately (prorated), a downgrade applies next period with no immediate charge. Through MCP it takes two calls. The first, without commit_token, is the preview and changes nothing: preview_result carries the money from Paddle's own pricing preview (immediate_charge, next_billed_amount, currency, proration_mode, new_price_sid, new_quantity, crosses_bracket) beside the commit_token. Show it to the user. status unanswered means no quote came back: say so before committing. The second call, same arguments plus commit_token, commits. The REST route takes no commit_token and commits on the call: POST /api/billing-subscriptions/{sid}/preview-change is its preview. manual (sales) subscriptions are not re-bracketed (422). The committed state arrives via webhook, and the response returns the optimistic post-change row. Provide at least one of quantity / price_sid. Requires billing.manage.

        Contract:
        - MCP tool `change_billing_subscription`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangeBillingSubscriptionRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ChangeBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: change_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/billing-subscriptions/{sid}/get-update-payment-method-link:
    post:
      operationId: get_billing_subscription_update_payment_method_link
      summary: Get update-payment-method link
      description: |-
        Return a short-lived Paddle portal deep link to update the card for this subscription (the typical past_due recovery path). No charge, mutates nothing on our side. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: read only.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingSubscriptionUpdatePaymentMethodLinkResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_subscription_update_payment_method_link
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/billing-subscriptions/{sid}/pause:
    post:
      operationId: pause_billing_subscription
      summary: Pause subscription
      description: |-
        Pause the subscription effective the next billing period. DANGEROUS state change (server-side confirm gate); while paused the applied team is gated like suspended, slots/data retained, billing stops. No charge. The committed status arrives via webhook. Resume with resume_billing_subscription. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PauseBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: pause_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/preview-change:
    post:
      operationId: preview_billing_subscription_change
      summary: Preview subscription change
      description: |-
        Read-only proration preview for a quantity / bracket-price change BEFORE committing. Calls Paddle Pricing Preview and returns the immediate charge (upgrade) or next-period credit (downgrade), the resolved new bracket price, and whether it crosses a bracket boundary. No state change, no charge. This is the confirmation gate to show the user before change_billing_subscription. Provide at least one of quantity / price_sid. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: read only.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PreviewBillingSubscriptionChangeRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreviewBillingSubscriptionChangeResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: preview_billing_subscription_change
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/billing-subscriptions/{sid}/remove-addon:
    post:
      operationId: remove_billing_subscription_addon
      summary: Remove subscription add-on
      description: |-
        Remove add-on units from the subscription, effective next period (no refund, no immediate charge). Pass quantity to give back part of the line, or omit it to drop the whole line; result.remaining_quantity reports what is left (0 means the line is gone). The price_sid must be a live item on this subscription (422 addon_not_on_subscription otherwise). Works while a cancel or pause is scheduled. A give-back Paddle did not confirm (its answer lost, or a 5xx) is 409 billing_change_unconfirmed: read the subscription again before repeating it. DANGEROUS state change (server-side confirm gate). Requires billing.manage.

        Contract:
        - MCP tool `remove_billing_subscription_addon`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RemoveBillingSubscriptionAddonRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RemoveBillingSubscriptionAddonResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: remove_billing_subscription_addon
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/resume:
    post:
      operationId: resume_billing_subscription
      summary: Resume subscription
      description: |-
        Resume a paused subscription; billing continues from the next period and the applied team re-derives active. DANGEROUS state change (server-side confirm gate). No charge. The committed status arrives via webhook. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResumeBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: resume_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/unapply:
    post:
      operationId: unapply_billing_subscription
      summary: Unapply subscription
      description: |-
        Detach a subscription from its team, returning it to floating on the buyer's balance. DANGEROUS: removes the team's capacity (the team goes suspended if this was its only applied subscription); does NOT cancel billing or refund. Used to move a subscription to another team. Requires billing.manage.

        Contract:
        - MCP tool `unapply_billing_subscription`, registry package `mcp.id/billing_subscriptions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UnapplyBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: unapply_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-subscriptions/{sid}/undo-cancel:
    post:
      operationId: undo_cancel_billing_subscription
      summary: Undo scheduled cancel
      description: |-
        Drop a scheduled cancel before it takes effect; billing continues as if cancel was never asked. Decided on the live Paddle state: nothing pending is a success no-op (cleared:false), a scheduled pause or resume is refused with 409 scheduled_change_is_not_cancel naming the verb that clears it, and an already canceled subscription is too late to undo. Synchronous, no charge, no pending block. Also the unlock a 409 subscription_locked_pending_changes points at. Requires billing.manage.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_subscriptions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - billing_subscriptions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing subscription sid (bl_sb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_sb_
            description: Billing subscription sid (bl_sb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UndoCancelBillingSubscriptionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: undo_cancel_billing_subscription
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_subscriptions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-transactions/metrics:
    post:
      operationId: get_billing_transactions_metrics
      summary: Billing transaction metrics
      description: |-
        Period-bound money sums over the caller's transactions. Requires period {from,to}. Money never crosses currencies; every sum lives inside a per-currency by_currency entry keyed by ISO 4217. Answers 'how much did I pay / tax this quarter'. Sums are GROSS (refunds not modeled in v1). Filter is the same object as search and every axis is applied; billed_at / created_at operators are dropped from the period-bound sums (period is the one window there) but they DO scope the counts block, which carries no period of its own. Requires billing.view.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/billing_transactions`, surface api).
        - Operation `metrics`, response envelope `metrics`.
        - Flags: read only.
      tags:
        - billing_transactions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetBillingTransactionsMetricsRequest"
      responses:
        "200":
          description: "`metrics` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingTransactionsMetricsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_transactions_metrics
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_transactions
      x-gtm-operation: metrics
      x-gtm-envelope: metrics
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-transactions/search:
    post:
      operationId: search_billing_transactions
      summary: Search billing transactions
      description: |-
        List billing transactions (invoices / charges) for the caller: one row per Paddle transaction, newest first. Filter by status / origin / collection_mode / currency / billed_at window, or locate one by invoice_number. include subscription / owner / team to hydrate context. Read-only, append-only ledger; page_size:0 returns counts only. Requires billing.view.

        Contract:
        - MCP tool `search_billing_transactions`, registry package `mcp.id/billing_transactions`, mount `id.billing`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - billing_transactions
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchBillingTransactionsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchBillingTransactionsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_billing_transactions
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_transactions
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/billing-transactions/{sid}:
    get:
      operationId: get_billing_transaction
      summary: Get billing transaction
      description: |-
        Fetch a single billing transaction by sid, with optional subscription / owner / team includes. Returns the frozen items[] charge snapshot inline.

        Contract:
        - MCP tool `get_billing_transaction`, registry package `mcp.id/billing_transactions`, mount `id.billing`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - billing_transactions
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_tx_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingTransactionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_transaction
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_transactions
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/billing-transactions/{sid}/get-invoice:
    post:
      operationId: get_billing_transaction_invoice
      summary: Get transaction invoice
      description: |-
        Fetch a temporary, time-limited URL for this transaction's invoice PDF from Paddle (never stored here; expires ~1h, opens inline). Works for self-serve card charges and sales-issued manual invoices. Returns invoice_not_ready before the transaction is billed, and invoice_not_available when Paddle issued no invoice for it (a $0 payment-method-change charge, a canceled checkout): the rows with a PDF are the ones carrying invoice_number. Read-only, mutates nothing. Requires billing.view.

        Contract:
        - MCP tool `get_billing_transaction_invoice`, registry package `mcp.id/billing_transactions`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: read only.
      tags:
        - billing_transactions
      parameters:
        - name: sid
          in: path
          required: true
          description: Billing transaction sid (bl_tx_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^bl_tx_
            description: Billing transaction sid (bl_tx_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBillingTransactionInvoiceResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_billing_transaction_invoice
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: billing_transactions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-account-directory/search:
    post:
      operationId: search_email_account_directory
      summary: Search mailbox directory
      description: |-
        List every mailbox of the workspace across its email servers: address, the server that holds it (email_box_sid), provider, status and its reason, sending pause, label. counts.groups splits the whole filter by server, status, provider, hold reason and pause. Read from id's directory, so a server that is down keeps its mailboxes listed. Sent today, limits and health stay on the mailbox's own server. page_size 0 counts only. Requires can_view_email_accounts.

        Contract:
        - MCP tool `search_email_account_directory`, registry package `mcp.id/email_account_directory`, mount `email.accounts`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - email_account_directory
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchEmailAccountDirectoryRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchEmailAccountDirectoryResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_email_account_directory
      x-gtm-mcp-mount: email.accounts
      x-gtm-entity: email_account_directory
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes:
    post:
      operationId: create_email_box
      summary: Buy email server
      description: |-
        Buy an email server: one unit of the plan's price on the workspace's subscription. Spends money. Two calls through MCP. The first, without commit_token, changes nothing; preview_result quotes it: payment (charged_now: amount_due_now, prorated, to the subscription's card; checkout: no subscription, nothing charged, a Paddle checkout only the app opens; kept_seat: a deleted server's seat pays, free), next_amount (recurring) and available. Show the user the money; do not commit when available is false; status unanswered: no quote came back, say so. The second, same arguments plus commit_token, buys: item is the new server in provisioning, run shows the build. REST buys on the call; preview: POST /api/email-boxes/preview-create. The same ask within 10 minutes buys nothing: that server, already_exists. 409 payment_declined, email_box_purchase_in_progress (a purchase is unfinished, nothing charged); 503 email_server_out_of_stock, email_server_stock_unknown, email_servers_not_offered. Requires can_manage_billing.

        Contract:
        - MCP tool `create_email_box`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `create`, response envelope `create`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - email_boxes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateEmailBoxRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateEmailBoxResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_email_box
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/email-boxes/confirm-checkout:
    post:
      operationId: confirm_email_box_checkout
      summary: Confirm email server checkout
      description: |-
        Finish a server purchase paid in the Paddle checkout the buy route opened for a workspace with no subscription: reads the transaction from Paddle, mirrors the subscription it created and builds the servers it paid for (result.items). Idempotent; the Paddle webhook does the same work, this makes it immediate. 409 checkout_not_paid until Paddle settles the payment (ask again); 404 for a transaction this workspace did not open. The app calls it when its checkout closes. Requires can_manage_billing.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/email_boxes`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - email_boxes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConfirmEmailBoxCheckoutRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConfirmEmailBoxCheckoutResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: confirm_email_box_checkout
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/preview-create:
    post:
      operationId: preview_email_box_create
      summary: Preview email server purchase
      description: |-
        Quote the purchase of an email server without making it: how it would be paid (payment: charged_now, checkout or kept_seat), what the purchase itself charges (amount_due_now), the server's recurring price (next_amount) and whether the plan's machine can be had where it was asked for (available, unavailable_reason). No state change, no charge. Through MCP the first call of create_email_box runs this route and carries its answer as preview_result. Requires can_manage_billing.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/email_boxes`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: read only.
      tags:
        - email_boxes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PreviewEmailBoxCreateRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreviewEmailBoxCreateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: preview_email_box_create
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/search:
    post:
      operationId: search_email_boxes
      summary: Search email servers
      description: |-
        List the workspace's email servers, oldest first: plan, location, status, seats_used of seats_cap, unit price, renews_at, and run (the newest unfinished lifecycle run, else the newest failed one: verb, status, phase_index of phase_count, error_code). Destroyed servers only when filter.status names destroyed. Use it to pick a sid, check room before a move, or watch a purchase or a plan change finish. No cursor; page_size 0 counts only. Requires can_view_email_accounts.

        Contract:
        - MCP tool `search_email_boxes`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - email_boxes
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchEmailBoxesRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchEmailBoxesResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_email_boxes
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/{sid}:
    patch:
      operationId: update_email_box
      summary: Rename email server
      description: |-
        Rename an email server: the label on the Email Accounts screen, 1 to 60 characters. Nothing else changes. Requires can_update_email_accounts.

        Contract:
        - MCP tool `update_email_box`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: Email server sid (em_bx_...).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
            description: Email server sid (em_bx_...).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateEmailBoxRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateEmailBoxResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_email_box
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    delete:
      operationId: delete_email_box
      summary: Delete email server
      description: |-
        Delete an email server that holds no mailbox: it reads destroying at once and the machine is destroyed. Its paid unit leaves the subscription with no refund (paid_through: the end of the paid period), except when it is the subscription's only item: then the subscription stays as it is, the unit stays paid (retained names subscription_seat, paid_through stays null) and the next create_email_box of the same plan takes it with no charge; ending the subscription is cancel_billing_subscription. Move its mailboxes out first (move_in_email_box_mailboxes on another server), else 409 email_box_has_mailboxes. 409 email_box_busy during a plan change, email_box_complimentary for the granted server. Repeating it is safe. Through MCP the first call only previews. Requires can_manage_billing.

        Contract:
        - MCP tool `delete_email_box`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteEmailBoxResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_email_box
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/{sid}/move-in:
    post:
      operationId: move_in_email_box_mailboxes
      summary: Move mailboxes into email server
      description: |-
        Move mailboxes from another email server of the workspace into this one (sid receives): up to 100, all on from_email_box_sid, both servers active. Runs in the background (result.run); the mailboxes stop syncing until they land, and a failure before the import puts them back. Hosted mailboxes and ones with mail queued to send stay. Watch run in search_email_boxes; retry_email_box_run resumes a failed move. 409 not_enough_seats (free, needed), email_box_busy. Requires can_update_email_accounts.

        Contract:
        - MCP tool `move_in_email_box_mailboxes`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: The server that receives the mailboxes (em_bx_...).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
            description: The server that receives the mailboxes (em_bx_...).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MoveInEmailBoxMailboxesRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MoveInEmailBoxMailboxesResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: move_in_email_box_mailboxes
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/{sid}/preview-resize:
    post:
      operationId: preview_email_box_resize
      summary: Preview email server plan change
      description: |-
        Quote a plan change of an email server without making it: whether its mailboxes fit the new plan (fits, seats_used, seats_cap_after), what Paddle would charge now (amount_due_now), the server's recurring price from the next period (next_amount) and whether the new plan's machine can be had for this server (available, unavailable_reason). No state change, no charge. Through MCP the first call of resize_email_box runs this route and carries its answer as preview_result. Requires can_manage_billing.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/email_boxes`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: read only.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: Email server sid (em_bx_...).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
            description: Email server sid (em_bx_...).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PreviewEmailBoxResizeRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreviewEmailBoxResizeResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: preview_email_box_resize
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/email-boxes/{sid}/resize:
    post:
      operationId: resize_email_box
      summary: Change email server plan
      description: |-
        Change an email server's plan. Spends money: its unit moves to the new plan's price, prorated now (an upgrade charges the difference, a downgrade credits it). The server reads resizing until the run ends; to or from dedicated it moves to a new machine and its sid changes. Through MCP it takes two calls. The first, without commit_token, changes nothing: preview_result carries the quote (fits, seats_used, seats_cap_after, amount_due_now, next_amount, available) beside the commit_token. Show the money to the user; do not commit when fits or available is false; status unanswered means no quote came back, say so. The second call, same arguments plus commit_token, commits. REST commits on the call; POST /api/email-boxes/{sid}/preview-resize is its preview. 409 email_box_does_not_fit, email_box_busy, email_box_complimentary, email_box_not_billed, email_box_disk_does_not_shrink; 422 email_box_already_on_plan; 503 email_server_out_of_stock, email_server_stock_unknown. Requires can_manage_billing.

        Contract:
        - MCP tool `resize_email_box`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: Email server sid (em_bx_...).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
            description: Email server sid (em_bx_...).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ResizeEmailBoxRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResizeEmailBoxResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: resize_email_box
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/email-boxes/{sid}/retry:
    post:
      operationId: retry_email_box_run
      summary: Retry email server run
      description: |-
        Retry the failed lifecycle run of an email server (a build, a plan change, a mailbox move or a delete): orchestration resumes it at the phase that failed. Read the failure first in search_email_boxes (run.status failed, run.error_code). No charge. 409 email_box_no_failed_run when the server's newest run did not fail; 409 email_box_busy while one is still running. Requires can_manage_billing.

        Contract:
        - MCP tool `retry_email_box_run`, registry package `mcp.id/email_boxes`, mount `id.billing`.
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - email_boxes
      parameters:
        - name: sid
          in: path
          required: true
          description: Email server sid (em_bx_...).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_bx_
            description: Email server sid (em_bx_...).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RetryEmailBoxRunResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: retry_email_box_run
      x-gtm-mcp-mount: id.billing
      x-gtm-entity: email_boxes
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/media-uploads/request-upload:
    post:
      operationId: request_media_upload
      summary: Request media upload
      description: |-
        Get a place for ONE image or video file, then pass its file_url to create_linkedin_post (images[].url or video.url) instead of base64. In a chat without HTTP (the user pasted or has the picture): give the user upload_link, ask them to open it and drop the file, and call create_linkedin_post with file_url once they confirm. With a shell: run the curl line (upload_link, replace <path>). Pass file_type to also get a pre-signed S3 POST form (upload). Never type base64 of a pasted image: the model sees pixels, not the file, and the bytes come out wrong. The link works once for 30 minutes, up to 35 MB, images PNG/JPEG/GIF/WEBP or video MP4/MOV/WEBM (checked by content). The file is public by URL and deleted after 7 days. 120 per workspace per hour.

        Contract:
        - MCP tool `request_media_upload`, registry package `mcp.id/media_uploads`, mount `id.platform`.
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - media_uploads
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RequestMediaUploadRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RequestMediaUploadResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: request_media_upload
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: media_uploads
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/notifications/metrics:
    post:
      operationId: get_notifications_metrics
      summary: Notifications metrics
      description: |-
        Period-bound delivery-health aggregates over a filtered notification set: how many notifications were delivered, failed, and rate-limited in the window. Requires period {from,to}. Optional filter and a single group_by axis (event_name / status / channel).

        Contract:
        - MCP tool `get_notifications_metrics`, registry package `mcp.id/notifications`, mount `id.platform`.
        - Operation `metrics`, response envelope `metrics`.
        - Flags: read only.
      tags:
        - notifications
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetNotificationsMetricsRequest"
      responses:
        "200":
          description: "`metrics` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNotificationsMetricsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_notifications_metrics
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: notifications
      x-gtm-operation: metrics
      x-gtm-envelope: metrics
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/notifications/search:
    post:
      operationId: search_notifications
      summary: Search notifications
      description: |-
        List notifications (email and in_app channels) for the team/user with filtering, sorting and cursor pagination: the user inbox ("what was sent to me?"), admin audit ("what did the system email Jane about?"), or failure triage (status:failed in the last 24h). No full-text search. Returns a counts block of predicate tallies (by status / event_name / channel). Bodies are omitted from list rows; call get_notification for the rendered body. On gtm-api.com every row is channel email: the in_app channel, read_at and the mark-read verbs are a shared-contract surface the GetSales side writes, so read_at is always null here and there is nothing to mark read.

        Contract:
        - MCP tool `search_notifications`, registry package `mcp.id/notifications`, mount `id.platform`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - notifications
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchNotificationsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchNotificationsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_notifications
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: notifications
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/notifications/{sid}:
    get:
      operationId: get_notification
      summary: Get notification
      description: |-
        Fetch a single notification by sid: the rendered subject / body, delivery state, and failure reason if any.

        Contract:
        - MCP tool `get_notification`, registry package `mcp.id/notifications`, mount `id.platform`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - notifications
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_nt_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNotificationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_notification
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: notifications
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    delete:
      operationId: delete_notification
      summary: Dismiss notification
      description: |-
        Dismiss a notification from the inbox: a soft-delete that sets deleted_at. DESTRUCTIVE (removes the row from inbox lists). It does NOT cancel in-flight delivery: if the delivery worker already picked the row up, the email still goes out. The audit row is retained (recoverable via deleted_at filters).

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/notifications`, surface api).
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - notifications
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_nt_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteNotificationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_notification
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: notifications
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/oauth-authorizations/search:
    post:
      operationId: search_oauth_authorizations
      summary: Search connected apps
      description: |-
        List the caller's connected apps (standing OAuth consent grants). Always scoped to the caller's own grants, never cross-user. Filter by status (active vs revoked history), oauth_client_sid, or team_scope_mode; include client (name + ceiling), teams (in-scope team names), and active_sessions (live installation tokens). This is the user's view of who has access to their workspaces. page_size:0 returns counts only.

        Contract:
        - MCP tool `search_oauth_authorizations`, registry package `mcp.id/oauth_authorizations`, mount `id.access`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - oauth_authorizations
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchOauthAuthorizationsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchOauthAuthorizationsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_oauth_authorizations
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_authorizations
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/oauth-authorizations/{sid}:
    patch:
      operationId: update_oauth_authorization
      summary: Edit connected app
      description: |-
        Partial self-service edit of the grant's mutable fields WITHOUT re-running the browser consent: team_scope_mode, consented_team_sids (full-replace, non-empty when mode=selected), and permissions (full-replace, must stay ⊆ the client ceiling). Each submitted team is re-checked against live membership (403 if not a member). Narrowing is security-positive; you can never exceed the ceiling via update. Changes are frozen-at-mint, so live tokens keep their claims until their short TTL; use revoke for an immediate cut. At least one field required. 404 if not the caller's own grant.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_authorizations`, surface api).
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - oauth_authorizations
      parameters:
        - name: sid
          in: path
          required: true
          description: OAuth authorization (grant) sid (id_oa_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_oa_
            description: OAuth authorization (grant) sid (id_oa_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOauthAuthorizationRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateOauthAuthorizationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_oauth_authorization
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_authorizations
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/oauth-authorizations/{sid}/revoke:
    post:
      operationId: revoke_oauth_authorization
      summary: Disconnect app (revoke grant)
      description: |-
        Disconnect an app: flip the grant to status=revoked, clear its refresh credential, and cascade-revoke every installation token (all teams) in one transaction, so the agent is cut off immediately. The envelope item is the post-action grant (it persists, revoked); result.revoked_sessions is the count cut. Idempotent (already-revoked → 0). 404 if the sid is not the caller's own grant.

        Contract:
        - MCP tool `revoke_oauth_authorization`, registry package `mcp.id/oauth_authorizations`, mount `id.access`.
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - oauth_authorizations
      parameters:
        - name: sid
          in: path
          required: true
          description: OAuth authorization (grant) sid (id_oa_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_oa_
            description: OAuth authorization (grant) sid (id_oa_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeOauthAuthorizationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: revoke_oauth_authorization
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_authorizations
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/oauth-clients:
    post:
      operationId: create_oauth_client
      summary: Create OAuth client
      description: |-
        Register a new OAuth application; the server generates client_id. v1 clients are public/PKCE (no secret). A confidential client (fast-follow) returns client_secret in the create envelope ONCE. Tell the user to store it; it is unrecoverable and must never be logged. permissions is the ceiling the client may request; redirect_uris is an exact-match https allow-list (closes open-redirect). Dedup (team_sid, name) → already_exists. Set platform:true (admin only) to register a platform client with no owning team.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_clients`, surface api).
        - Operation `create`, response envelope `create`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - oauth_clients
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOauthClientRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateOauthClientResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_oauth_client
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_clients
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/oauth-clients/search:
    post:
      operationId: search_oauth_clients
      summary: Search OAuth clients
      description: |-
        List registered OAuth applications for the caller's team (plus platform clients when team_sid.is_null). Filter by status, client_id, registration_kind, is_confidential; include:["active_sessions"] to see the agents connected through each app (requires sessions.view). No full-text: filter by name / client_id. page_size:0 returns counts only.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_clients`, surface api).
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - oauth_clients
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchOauthClientsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchOauthClientsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_oauth_clients
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_clients
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/oauth-clients/{sid}:
    get:
      operationId: get_oauth_client
      summary: Get OAuth client
      description: |-
        Fetch one OAuth client by sid. include:["active_sessions"] lists agents connected through it (requires sessions.view). client_secret is never returned on a read.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_clients`, surface api).
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - oauth_clients
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_oc_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - active_sessions
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetOauthClientResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_oauth_client
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_clients
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    patch:
      operationId: update_oauth_client
      summary: Update OAuth client
      description: |-
        Partial update. Editable: name, redirect_uris, permissions, grant_types, status (redirect_uris / permissions full-replace). status:"disabled" cascade-revokes the client's oauth grants and issued tokens. Tightening permissions affects only future mints: live tokens keep their frozen set; use disabled / delete for an immediate cut. client_id / is_confidential / registration_kind are not editable. At least one field required.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_clients`, surface api).
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - oauth_clients
      parameters:
        - name: sid
          in: path
          required: true
          description: OAuth client sid (id_oc_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_oc_
            description: OAuth client sid (id_oc_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOauthClientRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateOauthClientResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_oauth_client
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_clients
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
    delete:
      operationId: delete_oauth_client
      summary: Delete OAuth client
      description: |-
        Destructive. Soft-delete the client (sets deleted_at) and cascade-revoke every issued oauth session and grant, disconnecting all agents connected through this app immediately. The public OAuth flow rejects a soft-deleted client. Idempotent: re-deleting → already_deleted. The client's sessions survive as revoked-not-deleted (retained).

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/oauth_clients`, surface api).
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - oauth_clients
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_oc_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteOauthClientResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_oauth_client
      x-gtm-mcp-mount: id.access
      x-gtm-entity: oauth_clients
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/sessions/search:
    post:
      operationId: search_sessions
      summary: Search sessions
      description: |-
        List sessions. Default scope is the caller's own active sessions ("Active sessions"); pass kind:{eq:"oauth"} for "Connected agents", or status to see revoked/expired history. Each row carries the derived is_current flag (true for the caller's own request) so "log out everywhere except this device" can skip it. Returns a counts block. page_size:0 returns counts only.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/sessions`, surface api).
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - sessions
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchSessionsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchSessionsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_sessions
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: sessions
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/sessions/{sid}/revoke:
    post:
      operationId: revoke_session
      summary: Revoke session
      description: |-
        End a session immediately: status active → revoked. The token is rejected from the next request (verifier cache flushed within 30-60s). This is the canonical "delete" for this entity; there is no delete tool. Idempotent: revoking an already revoked/expired session returns the row with result.already_revoked:true.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/sessions`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - sessions
      parameters:
        - name: sid
          in: path
          required: true
          description: Session sid (id_se_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_se_
            description: Session sid (id_se_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeSessionResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: revoke_session
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: sessions
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/ssl-certificates:
    post:
      operationId: create_ssl_certificate
      summary: Register SSL certificate
      description: |-
        Register a custom domain as a certificate row in status='pending'. Does NOT start ACME; call issue_ssl_certificate next to begin the HTTP-01 flow. Idempotent on the domain natural key, and already_exists says whether the row was left as found. true: the team's row is returned as it stands (pending, active, or an attempt in flight whatever the status), nothing was written. false: a new row, or a failed/expired row with nothing in flight or a soft-deleted row recreated in place (same sid, reset to pending, challenge and last_error cleared; read last_error with get_ssl_certificate first if the reason matters). A domain whose certificate is active in another team returns 409 conflict (domain_active_in_another_team). A domain another team has only registered is not refused: the first certificate to go active holds it.

        Contract:
        - MCP tool `create_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `create`, response envelope `create`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - ssl_certificates
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSslCertificateRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/ssl-certificates/search:
    post:
      operationId: search_ssl_certificates
      summary: Search SSL certificates
      description: |-
        List the team's TLS certificates for custom email domains: which domains are registered, each status, issuer, issued_at, expires_at, and the redacted last_error for failures. Filter by status for live vs failed, by expires_at:{lte} for certificates expiring soon, or by domain for a specific FQDN. The certificate body and private key are never returned. Returns a counts block of predicate tallies; page_size:0 returns counts only.

        Contract:
        - MCP tool `search_ssl_certificates`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - ssl_certificates
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchSslCertificatesRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchSslCertificatesResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_ssl_certificates
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/ssl-certificates/{sid}:
    get:
      operationId: get_ssl_certificate
      summary: Get SSL certificate
      description: |-
        Fetch a single certificate by sid: status, issuer, validity window, redacted last_error, and the HTTP-01 challenge data while an attempt is in flight (status='challenge' on a first issuance, 'active' during a renewal). Poll this after issue/renew until challenge is null: a first issuance ends 'active' or 'failed' with last_error; a renewal stays 'active', with last_error null when the new certificate is live and set when it failed (the current one keeps serving). The cert body and key are never returned.

        Contract:
        - MCP tool `get_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - ssl_certificates
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sc_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    patch:
      operationId: update_ssl_certificate
      summary: Update SSL certificate
      description: |-
        Metadata-only partial update. No certificate-affecting field is mutable here: domain, status, challenge, issuer and validity are driven by the ACME actions and jobs, never by update. v1 has no client-mutable field, so any body returns 422 nothing_to_update; the endpoint exists for surface symmetry.

        Contract:
        - MCP tool `update_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `update`, response envelope `update`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - ssl_certificates
      parameters:
        - name: sid
          in: path
          required: true
          description: SSL certificate sid (id_sc_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sc_
            description: SSL certificate sid (id_sc_…).
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
    delete:
      operationId: delete_ssl_certificate
      summary: Delete SSL certificate
      description: |-
        Remove a custom domain's certificate. DESTRUCTIVE. Revokes the certificate at the CA (best-effort), removes the on-disk serving files, and soft-deletes the row. The CA-revoke and file-removal are external side effects, not a DB cascade, so this is a simple delete. No recovery: re-create + re-issue to restore.

        Contract:
        - MCP tool `delete_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - ssl_certificates
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sc_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/ssl-certificates/{sid}/issue:
    post:
      operationId: issue_ssl_certificate
      summary: Issue SSL certificate
      description: |-
        Start the ACME HTTP-01 flow for a registered domain. ASYNC: synchronously requests authorization from Let's Encrypt, stores the token + key-authorization, flips status→challenge, and returns the challenge data + a pending ref; the platform then self-checks, validates, finalizes and flips status→active in the background (poll get_ssl_certificate, or await the ssl-certificates.issued / .failed webhook). Use after create. Not idempotent: each call requests a fresh authorization. 409 conflict if the domain is already active (use renew), while an attempt is in flight (issuance_already_in_progress), or while another team's certificate for the domain is active (domain_active_in_another_team: nothing was started and retrying cannot help). An attempt already in flight when that happens ends failed, with last_error opening with the same reason.

        Contract:
        - MCP tool `issue_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `action`, response envelope `action_async`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - ssl_certificates
      parameters:
        - name: sid
          in: path
          required: true
          description: SSL certificate sid (id_sc_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sc_
            description: SSL certificate sid (id_sc_…).
      responses:
        "200":
          description: "`action_async` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IssueSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: issue_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: action
      x-gtm-envelope: action_async
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/ssl-certificates/{sid}/renew:
    post:
      operationId: renew_ssl_certificate
      summary: Renew SSL certificate
      description: |-
        Force a re-issue of an existing certificate, ignoring the 30-day expiry window (operator-forced). ASYNC: same HTTP-01 path as issue and the auto-renew job, on the same row. On an active certificate the row STAYS active (it keeps serving and routing) while challenge carries the attempt: on success the persisted leaf / full chain / key are replaced and issued_at / expires_at re-stamped, on failure last_error is set and the current certificate keeps serving. On a pending/failed/expired row nothing is serving, so it flips status→challenge and ends active or failed like issue. Poll get_ssl_certificate until challenge is null, or await ssl-certificates.renewed / .failed. Use after a CA chain fix, to retry a failing renewal once its cause is fixed, or to recover a failed/expired certificate. 409 conflict while an attempt is in flight (issuance_already_in_progress, e.g. the renew job's) or while another team's certificate for the domain is active (domain_active_in_another_team, retrying cannot help).

        Contract:
        - MCP tool `renew_ssl_certificate`, registry package `mcp.id/ssl_certificates`, mount `id.platform`.
        - Operation `action`, response envelope `action_async`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - ssl_certificates
      parameters:
        - name: sid
          in: path
          required: true
          description: SSL certificate sid (id_sc_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sc_
            description: SSL certificate sid (id_sc_…).
      responses:
        "200":
          description: "`action_async` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RenewSslCertificateResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: renew_ssl_certificate
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: ssl_certificates
      x-gtm-operation: action
      x-gtm-envelope: action_async
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: complex
  /api/support-requests:
    post:
      operationId: escalate_to_human
      summary: Escalate to a human
      description: |-
        Hand the current issue to the human support team. Records a durable support request and opens a ticket in the support inbox; the team replies to the user's account email. Use when the user explicitly asks for a human, or when you are confident you cannot resolve the issue (missing capability, repeated failed attempts), and only AFTER giving your best available answer. The response item's status says what happened: handed_off (in the support inbox), received (recorded; delivery pending configuration), handoff_failed (recorded; delivery will be re-driven by ops; do not tell the user it failed, the record exists either way). Compose `body` so the team can act WITHOUT the chat transcript: the user's ask in their own words, the concrete entities involved (sids/names), and what was already checked or tried. Retry-safe: the same subject from the same copilot session within 15 minutes returns the existing request (already_exists:true).

        Contract:
        - MCP tool `escalate_to_human`, registry package `mcp.id/support_requests`, mount `id.platform`.
        - Operation `create`, response envelope `create`.
        - Flags: none.
      tags:
        - support_requests
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EscalateToHumanRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EscalateToHumanResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: escalate_to_human
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: support_requests
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/support-requests/search:
    post:
      operationId: search_support_requests
      summary: Search support requests
      description: |-
        List the team's support escalations with filtering, sorting and cursor pagination: the ops view ("what escalations are open?", "did this session already escalate?"). Returns a counts block of predicate tallies (by status / reason). Bodies are omitted from list rows; call get_support_request for the full text. No full-text search.

        Contract:
        - MCP tool `search_support_requests`, registry package `mcp.id/support_requests`, mount `id.platform`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - support_requests
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchSupportRequestsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchSupportRequestsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_support_requests
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: support_requests
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/support-requests/{sid}:
    get:
      operationId: get_support_request
      summary: Get support request
      description: |-
        Fetch a single support escalation by sid: the full body the team received, handoff state (intercom_ticket_id, handed_off_at) and the redacted delivery error if the handoff failed.

        Contract:
        - MCP tool `get_support_request`, registry package `mcp.id/support_requests`, mount `id.platform`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - support_requests
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^id_sr_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetSupportRequestResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_support_request
      x-gtm-mcp-mount: id.platform
      x-gtm-entity: support_requests
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/team-members:
    post:
      operationId: create_team_member
      summary: Invite team member
      description: |-
        Invite a person by email with exactly one of preset or permissions (both or neither is 422). preset names a grant: operator (runs outreach end to end, no org or billing management) or view_only (reads the workspace, acts on nothing). permissions is the explicit token list validated against the catalog. Either way: 403 grant_exceeds_ceiling when it exceeds the CALLER's own grant; '*' is grantable only by the owner or a wildcard holder; can_view_teams is always added - the membership floor. Born status=invited, user_sid=null, with a one-time code (+7d expiry); dispatches the invite email. account_sids is the optional profile slice (null/omitted = all team profiles; an explicit empty list is refused, and a sliced caller cannot grant beyond their own slice). Natural key (team, email) over live rows; re-inviting a live member returns already_exists:true.

        Contract:
        - MCP tool `create_team_member`, registry package `mcp.id/team_members`, mount `id.identity`.
        - Operation `create`, response envelope `create`.
        - Flags: none.
      tags:
        - team_members
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTeamMemberRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateTeamMemberResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_team_member
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/team-members/accept-invitation:
    post:
      operationId: accept_team_member_invitation
      summary: Accept team-member invitation
      description: |-
        Accept a pending invite by its one-time code. Public REST: code-bearer, no team scope. Hashes the code, matches the row it belongs to and branches on that row: invited → flips invited → active, binds the authenticated user_sid, and sets users.default_team_sid if the user had none; already active for the SAME user → 200 already_accepted:true naming that same invite; already redeemed by another account → 409 invitation_already_redeemed; no row (unknown, cancelled, or the membership was removed) → 404. An expired code is 409 invitation_expired, a seatless plan 402.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/team_members`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - team_members
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AcceptTeamMemberInvitationRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcceptTeamMemberInvitationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: accept_team_member_invitation
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/team-members/search:
    post:
      operationId: search_team_members
      summary: Search team members
      description: |-
        List members and pending invites in the caller's team: render the Members tab, find pending invites (filter.user_sid.is_null or filter.status.eq="invited"), or look up a member by email (q). include:["user"] hydrates the resolved profile (absent for pending invites). Returns a counts block. page_size:0 returns counts only.

        Contract:
        - MCP tool `search_team_members`, registry package `mcp.id/team_members`, mount `id.identity`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - team_members
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchTeamMembersRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchTeamMembersResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_team_members
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/team-members/{sid}:
    patch:
      operationId: update_team_member
      summary: Update team member
      description: |-
        Re-scope an existing member: replace permissions and/or account_sids. email / status / user_sid / team_sid are read-only (rejected silently). At least one field with an ACTUAL change required (a value-identical PATCH answers 422 nothing_to_update). The change applies immediately: the member's live tokens are invalidated and re-minted with the new grant on their next request (agents re-exchange). Bounded by the caller's own grant (403 grant_exceeds_ceiling); the structural owner's seat is not re-scopable (409 owner_cannot_be_rescoped: ownership moves in the app's Workspace settings or by the transfer-ownership route of the REST API, no MCP tool since 2026-11-06).

        Contract:
        - MCP tool `update_team_member`, registry package `mcp.id/team_members`, mount `id.identity`.
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - team_members
      parameters:
        - name: sid
          in: path
          required: true
          description: Team-member (membership/invite) sid (ts_mb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_mb_
            description: Team-member (membership/invite) sid (ts_mb_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTeamMemberRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateTeamMemberResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_team_member
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
    delete:
      operationId: delete_team_member
      summary: Remove team member
      description: |-
        Remove a pending invite OR kick an active member: one tool, soft-delete. DESTRUCTIVE. The structural owner is protected (409 conflict, owner_cannot_be_removed); move ownership first, in the app's Workspace settings or by the transfer-ownership route of the REST API (no MCP tool since 2026-11-06). Kicking a member revokes their sessions in this team only.

        Contract:
        - MCP tool `delete_team_member`, registry package `mcp.id/team_members`, mount `id.identity`.
        - Operation `delete`, response envelope `delete_simple`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - team_members
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_mb_
      responses:
        "200":
          description: "`delete_simple` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteTeamMemberResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_team_member
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: delete
      x-gtm-envelope: delete_simple
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/team-members/{sid}/resend-invitation:
    post:
      operationId: resend_team_member_invitation
      summary: Resend team-member invitation
      description: |-
        Re-roll the one-time code on a pending invite, push its expiry (+7d), and re-send the invite email. Only valid on a status=invited row (else 409 invalid_transition).

        Contract:
        - MCP tool `resend_team_member_invitation`, registry package `mcp.id/team_members`, mount `id.identity`.
        - Operation `action`, response envelope `action`.
        - Flags: none.
      tags:
        - team_members
      parameters:
        - name: sid
          in: path
          required: true
          description: Team-member (membership/invite) sid (ts_mb_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_mb_
            description: Team-member (membership/invite) sid (ts_mb_…).
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResendTeamMemberInvitationResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: resend_team_member_invitation
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: team_members
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
  /api/teams:
    post:
      operationId: create_team
      summary: Create team
      description: |-
        Create a new workspace. The caller becomes the owner AND the first member; the free "Sandbox" plan (forever free, 1 account slot, no card) is applied automatically where the owner does not already run a free workspace. Names are not unique: every call creates a new team (no dedup).

        Contract:
        - MCP tool `create_team`, registry package `mcp.id/teams`, mount `id.identity`.
        - Operation `create`, response envelope `create`.
        - Flags: none.
      tags:
        - teams
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTeamRequest"
      responses:
        "200":
          description: "`create` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateTeamResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: create_team
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: create
      x-gtm-envelope: create
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/teams/search:
    post:
      operationId: search_teams
      summary: Search teams
      description: |-
        List the caller's teams ("my workspaces"): teams they are a member of, plus teams they own. Filter by status to find suspended workspaces, or by subscription_sid.is_null for teams with no capacity. q does an infix match on name. include[] hydrates subscription / owner / member counts. Returns a counts block. page_size:0 returns counts only.

        Contract:
        - MCP tool `search_teams`, registry package `mcp.id/teams`, mount `id.identity`.
        - Operation `search`, response envelope `search`.
        - Flags: read only.
      tags:
        - teams
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchTeamsRequest"
      responses:
        "200":
          description: "`search` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchTeamsResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: search_teams
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: search
      x-gtm-envelope: search
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/teams/{sid}:
    get:
      operationId: get_team
      summary: Get team
      description: |-
        Fetch a single team by sid, with optional includes (applied subscription, owner, member counts).

        Contract:
        - MCP tool `get_team`, registry package `mcp.id/teams`, mount `id.identity`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - teams
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
        - name: include[]
          in: query
          required: false
          description: Query parameter `include`.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - subscription
                - owner
                - members_counts
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetTeamResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_team
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    patch:
      operationId: update_team
      summary: Update team
      description: |-
        Rename a team or edit its config. Only name / config are mutable; owner_user_sid (transfer-ownership), status (derived), subscription_sid (apply/unapply) and limits (system) are read-only and silently rejected. At least one field required.

        Contract:
        - MCP tool `update_team`, registry package `mcp.id/teams`, mount `id.identity`.
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - teams
      parameters:
        - name: sid
          in: path
          required: true
          description: Team sid (ts_tm_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
            description: Team sid (ts_tm_…).
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTeamRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateTeamResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_team
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
    delete:
      operationId: delete_team
      summary: Delete team
      description: |-
        Cascade soft-delete a workspace and its owned rows (members, keys, sessions, oauth clients, certs). Owner-only. DESTRUCTIVE. Blocked (409 delete_blocked) while a paid applied subscription is live. Unapply/cancel it first; clear soft blockers (active keys / members) with acknowledge[]. Deleting the owner's LAST workspace is allowed and leaves their ACCOUNT untouched: they are left with no workspace until their next sign-in provisions a replacement. Erasing an account is a separate deliberate act, never a side effect of this tool. There is no restore: the deleted workspace cannot be brought back, cascade.recovery_available_until is null, and its data is erased 30 days later.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/teams`, surface api).
        - Operation `delete`, response envelope `delete_cascade`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - teams
      parameters:
        - name: sid
          in: path
          required: true
          description: Path segment `{sid}`.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
        - name: acknowledge[]
          in: query
          required: false
          description: Resolution codes for soft blockers the user confirmed.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - revoke_keys
                - remove_members
            description: Resolution codes for soft blockers the user confirmed.
        - name: next_default_team_sid
          in: query
          required: false
          description: Which of the caller's other live memberships becomes their working team afterwards; default is the oldest one. 422 if it is not an active membership of theirs in another live team.
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
            description: Which of the caller's other live memberships becomes their working team afterwards; default is the oldest one. 422 if it is not an active membership of theirs in another live team.
      responses:
        "200":
          description: "`delete_cascade` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteTeamResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: delete_team
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: delete
      x-gtm-envelope: delete_cascade
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/teams/{sid}/transfer-ownership:
    post:
      operationId: transfer_team_ownership
      summary: Transfer team ownership
      description: |-
        Move structural ownership of the team to another active member. Owner-only (an admin cannot transfer). Transferring to the current owner is a no-op. This is the only way to change owner_user_sid, and the prerequisite for the current owner to leave the team.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/teams`, surface api).
        - Operation `action`, response envelope `action`.
        - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
      tags:
        - teams
      parameters:
        - name: sid
          in: path
          required: true
          description: Team sid (ts_tm_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
            description: Team sid (ts_tm_…).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransferTeamOwnershipRequest"
      responses:
        "200":
          description: "`action` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransferTeamOwnershipResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: transfer_team_ownership
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: teams
      x-gtm-operation: action
      x-gtm-envelope: action
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: true
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
  /api/users/current:
    get:
      operationId: get_current_user
      summary: Get current user
      description: |-
        Return the authenticated user's own profile: the JWT subject, self only (no {sid} form). include[]=default_team hydrates the working team; include[]=accessible_teams returns the owner + active-membership union (workspace switcher / OAuth consent multiselect). Reads email, name, timezone, default_team_sid. Needs a credential with a person behind it (an app session or an OAuth connector). An API key authenticates as itself, not as a user, so on a key this answers 403 with context.reason=not_a_user_actor and no permission changes that.

        Contract:
        - MCP tool `get_current_user`, registry package `mcp.id/users`, mount `id.identity`.
        - Operation `get`, response envelope `get`.
        - Flags: read only.
      tags:
        - users
      parameters:
        - name: include[]
          in: query
          required: false
          description: "Relations to eager-load: default_team, accessible_teams."
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - default_team
                - accessible_teams
            description: "Relations to eager-load: default_team, accessible_teams."
      responses:
        "200":
          description: "`get` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetCurrentUserResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: get_current_user
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: users
      x-gtm-operation: get
      x-gtm-envelope: get
      x-gtm-availability: ga
      x-gtm-surface: both
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: trivial
    patch:
      operationId: update_current_user
      summary: Update current user
      description: |-
        Patch the authenticated user's own profile: first_name / last_name / avatar_url / phone / timezone / country / config only. email (change-email flow), password (change-password flow), auth_provider, email_status and all sids are rejected if sent. At least one field required. config merges key-by-key. Same subject as get_current_user: an API key has no user to patch and answers 403 with context.reason=not_a_user_actor.

        Contract:
        - REST only: no MCP tool serves this route (registry package `mcp.id/users`, surface api).
        - Operation `update`, response envelope `update`.
        - Flags: none.
      tags:
        - users
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCurrentUserRequest"
      responses:
        "200":
          description: "`update` success envelope."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateCurrentUserResponse"
        4XX:
          $ref: "#/components/responses/McpClientError"
        5XX:
          $ref: "#/components/responses/McpServerError"
      x-gtm-mcp-tool: update_current_user
      x-gtm-mcp-mount: id.identity
      x-gtm-entity: users
      x-gtm-operation: update
      x-gtm-envelope: update
      x-gtm-availability: ga
      x-gtm-surface: api
      x-gtm-dangerous: false
      x-gtm-mass-action: false
      x-gtm-step-eligible: false
      x-gtm-schedule-required: false
      x-gtm-tool-class: typical
components:
  securitySchemes:
    BearerJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Access token issued by gtm.service.id. Its `access_identity` claim carries `team_sid`, `actor_sid` and `actor_type`, and that team scope is authoritative.
    TeamSid:
      type: apiKey
      in: header
      name: Team-SID
      description: Team scope for tokens that do not carry one. Ignored when the token already names a team.
  responses:
    McpClientError:
      description: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/McpError"
          examples:
            validation_failed:
              summary: "422: a field of the request failed validation"
              value:
                success: false
                error:
                  code: validation_failed
                  message: Validation failed
                  recoverable: true
                  field_errors:
                    page_size:
                      - rule: max
                        message: The page size field must not be greater than 1000.
                meta:
                  trace_id: 019a7c2e-5b1d-7c3a-9f4e-2a6b8d0c1e3f
                  span_id: 5f0c9a2e7b4d1c38
                  timestamp: "2026-11-13T09:30:00Z"
                  duration_ms: 41
                  team_sid: ts_tm_Bv9nK4xP1sD7
                  actor_type: api_key
            unauthorized:
              summary: "401: no bearer token, or one that does not verify"
              value:
                success: false
                error:
                  code: unauthorized
                  message: Authentication required
                  recoverable: true
                  context:
                    reason: missing_or_invalid_token
                meta:
                  trace_id: 019a7c2e-5b1d-7c3a-9f4e-2a6b8d0c1e3f
                  span_id: 5f0c9a2e7b4d1c38
                  timestamp: "2026-11-13T09:30:00Z"
                  duration_ms: 41
                  team_sid: null
                  actor_type: null
    McpServerError:
      description: MCP error envelope with `error.code` internal_error or service_unavailable.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/McpError"
          examples:
            service_unavailable:
              summary: "503: something the call depends on did not answer; the same call can be made again"
              value:
                success: false
                error:
                  code: service_unavailable
                  message: "Service unavailable: upstream unavailable"
                  recoverable: true
                  context:
                    reason: upstream_unavailable
                meta:
                  trace_id: 019a7c2e-5b1d-7c3a-9f4e-2a6b8d0c1e3f
                  span_id: 5f0c9a2e7b4d1c38
                  timestamp: "2026-11-13T09:30:00Z"
                  duration_ms: 41
                  team_sid: ts_tm_Bv9nK4xP1sD7
                  actor_type: api_key
            internal_error:
              summary: "500: a fault on our side; a retry does not help, report meta.trace_id"
              value:
                success: false
                error:
                  code: internal_error
                  message: Internal error
                  recoverable: false
                  context:
                    reason: internal_error
                meta:
                  trace_id: 019a7c2e-5b1d-7c3a-9f4e-2a6b8d0c1e3f
                  span_id: 5f0c9a2e7b4d1c38
                  timestamp: "2026-11-13T09:30:00Z"
                  duration_ms: 41
                  team_sid: ts_tm_Bv9nK4xP1sD7
                  actor_type: api_key
  schemas:
    AcceptTeamMemberInvitationRequest:
      type: object
      description: Request body of `accept_team_member_invitation`.
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 255
          description: Raw one-time invite code from the email link.
      required:
        - code
    AcceptTeamMemberInvitationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
              nullable: true
            email:
              type: string
            status:
              type: string
              enum:
                - invited
                - active
                - revoked
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - user_sid
            - email
            - status
            - permissions
            - account_sids
            - created_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    AddBillingSubscriptionAddonRequest:
      type: object
      description: Request body of `add_billing_subscription_addon`.
      properties:
        price_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_pc_
          description: The add-on price (product.type=addon).
        quantity:
          type: integer
          minimum: 1
          description: Units of the add-on.
      required:
        - price_sid
        - quantity
    AddBillingSubscriptionAddonResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ApplyBillingSubscriptionRequest:
      type: object
      description: Request body of `apply_billing_subscription`.
      properties:
        team_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^ts_tm_
          description: "Team sid (ts_tm_…): the applied team."
      required:
        - team_sid
    ApplyBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    CancelBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ChangeBillingSubscriptionRequest:
      type: object
      description: Request body of `change_billing_subscription`.
      properties:
        quantity:
          type: integer
          minimum: 1
          description: New slot count (re-bracketed). Omit for a price-only change.
        price_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_pc_
          description: Explicit target bracket; usually derived from quantity.
    ChangeBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ConfirmEmailBoxCheckoutRequest:
      type: object
      description: Request body of `confirm_email_box_checkout`.
      properties:
        paddle_transaction_id:
          type: string
          maxLength: 64
          pattern: ^txn_
          description: The Paddle transaction (txn_...) of the checkout, as the buy route answered it.
      required:
        - paddle_transaction_id
    ConfirmEmailBoxCheckoutResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            items:
              type: array
              items:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  name:
                    type: string
                    description: The label the customer chose; "Server N" when nobody did.
                  plan:
                    type: string
                    enum:
                      - starter
                      - growth
                      - agency
                      - dedicated
                    description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
                  location:
                    type: string
                    nullable: true
                    enum:
                      - hel1
                      - fsn1
                      - nbg1
                    description: Null on a server older than the choice.
                  status:
                    type: string
                    enum:
                      - provisioning
                      - active
                      - suspended
                      - resizing
                      - destroying
                      - destroyed
                      - failed
                    description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
                  suspended_reason:
                    type: string
                    nullable: true
                    enum:
                      - payment_failed
                      - unpaid
                    description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
                  destroy_at:
                    type: string
                    nullable: true
                    description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
                  complimentary:
                    type: boolean
                    description: The server granted without a paid unit; it cannot be resized or deleted.
                  seats_cap:
                    type: integer
                    minimum: 0
                    description: Mailboxes the server can hold.
                  seats_used:
                    type: integer
                    minimum: 0
                    description: Mailboxes it holds now.
                  ipv4:
                    type: string
                    nullable: true
                  release:
                    type: string
                    nullable: true
                    description: The gtm.service.email release the server runs.
                  run:
                    type: object
                    nullable: true
                    properties:
                      verb:
                        type: string
                        description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                      status:
                        type: string
                        description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                      phase:
                        type: string
                        nullable: true
                      phase_index:
                        type: integer
                        minimum: 0
                        description: 1-based among phase_count; 0 before the first phase started.
                      phase_count:
                        type: integer
                        minimum: 0
                      started_at:
                        type: string
                        nullable: true
                      error_code:
                        type: string
                        nullable: true
                    required:
                      - verb
                      - status
                      - phase
                      - phase_index
                      - phase_count
                      - started_at
                      - error_code
                    description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
                  price:
                    type: object
                    nullable: true
                    properties:
                      amount:
                        type: string
                        description: Decimal string, e.g. "49.00".
                      currency:
                        type: string
                        description: ISO 4217.
                      interval:
                        type: string
                        description: month or year.
                    required:
                      - amount
                      - currency
                      - interval
                    description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
                  renews_at:
                    type: string
                    nullable: true
                    description: The subscription's next billing date.
                  paid_through:
                    type: string
                    nullable: true
                    description: "Set by a delete: the end of the period the server was paid for."
                  failed_error_code:
                    type: string
                    nullable: true
                  created_at:
                    type: string
                    nullable: true
                  provisioned_at:
                    type: string
                    nullable: true
                  suspended_at:
                    type: string
                    nullable: true
                  updated_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - name
                  - plan
                  - location
                  - status
                  - suspended_reason
                  - complimentary
                  - seats_cap
                  - seats_used
                  - ipv4
                  - release
                  - run
                  - price
                  - renews_at
                  - paid_through
                  - failed_error_code
                  - created_at
                  - provisioned_at
                  - suspended_at
                  - updated_at
          required:
            - items
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    CreateAccountShareRequest:
      type: object
      description: Request body of `create_account_share`.
      properties:
        channel:
          type: string
          enum:
            - linkedin
            - email
          description: Which channel service owns the account you are lending.
        account_sid:
          type: string
          minLength: 18
          maxLength: 18
          description: "The owned account to lend. Length checked only, never prefix checked: the same field names a LinkedIn account (ln_ac_), an email account (em_ac_) or a future channel's sender, and `channel` is what says which."
        to_email:
          type: string
          maxLength: 255
          format: email
          description: "Default targeting: the holder team is that user's working team. Exactly one of to_email or to_team_sid."
        to_team_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^ts_tm_
          description: Direct targeting. Exactly one of to_email or to_team_sid; it must not be your own team.
        planned_return_at:
          type: string
          nullable: true
          description: "ISO 8601 UTC. Informational only: it drives one owner reminder email with a recall link. There is NO auto return."
      required:
        - channel
        - account_sid
    CreateAccountShareResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
              description: "The OWNER team: the row tenant, the side that lent the account out."
            channel:
              type: string
              enum:
                - linkedin
                - email
              description: Which channel service owns the physical account pair.
            to_team_sid:
              type: string
              description: "The HOLDER team: the side that borrowed the account."
            to_user_sid:
              type: string
              nullable: true
              description: Resolved user when the share was targeted by email; null when targeted by team sid.
            to_email:
              type: string
              nullable: true
              description: The targeting input kept for audit; null when targeted by team sid.
            owner_cluster_id:
              type: integer
            holder_cluster_id:
              type: integer
            owner_account_sid:
              type: string
              description: "The owner's channel account row, parked for the duration of the loan. Prefix agnostic: ln_ac_ on LinkedIn, em_ac_ on email."
            owner_channel_ref:
              type: string
              nullable: true
              description: Opaque second row the channel needs to name (LinkedIn puts its ab_br_ browser sid here); null when the channel needs none.
            holder_account_sid:
              type: string
              nullable: true
              description: The holder's copy. NULL until the copy phase lands, so it is null on every pre-active row.
            holder_channel_ref:
              type: string
              nullable: true
            owner_account_label:
              type: string
              nullable: true
              description: "The channel's display name for the lent account, e.g. \"Jane Roe (jane-roe)\". Use it to tell one share from another when reporting to a human. Null when the channel had no name to give. Display only: never filter, match or reason on it."
            status:
              type: string
              enum:
                - pending
                - owner_parked
                - active
                - closing
                - holder_released
                - rolling_back
                - returned
                - recalled
                - failed
              description: The durable phase, and the answer to "did the loan start". Only active means the holder can work.
            holder_over_slot:
              type: boolean
              description: True when the holder had no free account slot at create, so the copy landed in the channel's subscription hold. The loan still reaches active; the holder cannot work until it upgrades.
            end_reason:
              type: string
              nullable: true
              enum:
                - returned_by_holder
                - recalled_by_owner
                - holder_deleted_copy
                - holder_team_purged
                - owner_team_purged
              description: Stamped when an ending is REQUESTED. Only ever set on a row that reached active.
            failure_reason:
              type: string
              nullable: true
              enum:
                - park_failed
                - export_failed
                - copy_refused
                - probe_stale
                - team_purged
              description: Why a pre-active phase gave up. Non null on exactly rolling_back and failed.
            planned_return_at:
              type: string
              nullable: true
              description: Informational only. When it passes the owner is emailed a recall link once; there is NO auto return.
            expiry_notified_at:
              type: string
              nullable: true
            phase_claimed_at:
              type: string
              nullable: true
            phase_attempts:
              type: integer
              description: Attempts on the CURRENT phase, reset on every advance. A large and growing value is the stuck signal on a phase that may not give up.
            ended_at:
              type: string
              nullable: true
            ended_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
              description: Who ended it. The machine readable why is end_reason (an ending) or failure_reason (a failure), never this blob.
            created_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - team_sid
            - channel
            - to_team_sid
            - to_user_sid
            - to_email
            - owner_cluster_id
            - holder_cluster_id
            - owner_account_sid
            - owner_channel_ref
            - holder_account_sid
            - holder_channel_ref
            - owner_account_label
            - status
            - holder_over_slot
            - end_reason
            - failure_reason
            - planned_return_at
            - expiry_notified_at
            - phase_claimed_at
            - phase_attempts
            - ended_at
            - ended_by
            - created_by
            - created_at
            - updated_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    CreateApiKeyRequest:
      type: object
      description: Request body of `create_api_key`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
          description: Human-readable key name; unique among the team's non-revoked keys.
        permissions:
          type: array
          items:
            type: string
            maxLength: 128
          description: Unified permission list; must be ⊆ the parent key on delegation.
        account_sids:
          type: array
          nullable: true
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^(ln_ac_|em_ac_)
          minItems: 1
          description: Channel-account slice the key reaches (ln_ac_*/em_ac_*); null/omitted = all team accounts, grantable only by an issuer whose own slice is unrestricted. An empty list is refused (422).
        expires_at:
          type: string
          nullable: true
          description: ISO 8601 UTC; omit = now + 3 years; null = perpetual.
      required:
        - name
        - permissions
    CreateApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
            token_prefix:
              type: string
            token_last4:
              type: string
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
                - expired
            expires_at:
              type: string
              nullable: true
            last_used_at:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            plaintext_token:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - token_prefix
            - token_last4
            - permissions
            - account_sids
            - status
            - expires_at
            - last_used_at
            - created_by
            - created_at
            - updated_at
            - deleted_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    CreateBillingSubscriptionCheckoutRequest:
      type: object
      description: Request body of `create_billing_subscription_checkout`.
      properties:
        price_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_pc_
          description: "Billing price sid (bl_pc_…): a bracket / cadence price."
        quantity:
          type: integer
          minimum: 1
          description: Slots to buy on the base plan line; must fall inside the price bracket.
        team_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^ts_tm_
          description: Apply to this team on activation; omit / null to buy floating.
        addons:
          type: array
          items:
            type: object
            properties:
              price_sid:
                type: string
                minLength: 18
                maxLength: 18
                pattern: ^bl_pc_
                description: "Billing price sid (bl_pc_…): a bracket / cadence price."
              quantity:
                type: integer
                minimum: 1
            required:
              - price_sid
              - quantity
          description: Optional add-on items bought in the same checkout (one Paddle transaction).
      required:
        - price_sid
        - quantity
    CreateBillingSubscriptionCheckoutResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    CreateEmailBoxRequest:
      type: object
      description: Request body of `create_email_box`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The server's label, 1 to 60 characters.
        plan:
          type: string
          enum:
            - starter
            - growth
            - agency
            - dedicated
          description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
        location:
          type: string
          enum:
            - hel1
            - fsn1
            - nbg1
          description: hel1 Helsinki, fsn1 Falkenstein, nbg1 Nuremberg.
        copy_settings_from:
          type: string
          nullable: true
          minLength: 18
          maxLength: 18
          pattern: ^em_bx_
          description: "A serving server of this workspace whose settings and stop-list the new one starts with. Omitted: the stop-list comes from the oldest active server."
      required:
        - name
        - plan
        - location
    CreateEmailBoxResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
              description: The label the customer chose; "Server N" when nobody did.
            plan:
              type: string
              enum:
                - starter
                - growth
                - agency
                - dedicated
              description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
            location:
              type: string
              nullable: true
              enum:
                - hel1
                - fsn1
                - nbg1
              description: Null on a server older than the choice.
            status:
              type: string
              enum:
                - provisioning
                - active
                - suspended
                - resizing
                - destroying
                - destroyed
                - failed
              description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
            suspended_reason:
              type: string
              nullable: true
              enum:
                - payment_failed
                - unpaid
              description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
            destroy_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
            complimentary:
              type: boolean
              description: The server granted without a paid unit; it cannot be resized or deleted.
            seats_cap:
              type: integer
              minimum: 0
              description: Mailboxes the server can hold.
            seats_used:
              type: integer
              minimum: 0
              description: Mailboxes it holds now.
            ipv4:
              type: string
              nullable: true
            release:
              type: string
              nullable: true
              description: The gtm.service.email release the server runs.
            run:
              type: object
              nullable: true
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
              description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
            price:
              type: object
              nullable: true
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
            renews_at:
              type: string
              nullable: true
              description: The subscription's next billing date.
            paid_through:
              type: string
              nullable: true
              description: "Set by a delete: the end of the period the server was paid for."
            failed_error_code:
              type: string
              nullable: true
            created_at:
              type: string
              nullable: true
            provisioned_at:
              type: string
              nullable: true
            suspended_at:
              type: string
              nullable: true
            updated_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - plan
            - location
            - status
            - suspended_reason
            - complimentary
            - seats_cap
            - seats_used
            - ipv4
            - release
            - run
            - price
            - renews_at
            - paid_through
            - failed_error_code
            - created_at
            - provisioned_at
            - suspended_at
            - updated_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        checkout:
          type: object
          nullable: true
          properties:
            client_side_token:
              type: string
              nullable: true
            paddle_environment:
              type: string
            paddle_transaction_id:
              type: string
              nullable: true
          required:
            - client_side_token
            - paddle_environment
            - paddle_transaction_id
          description: "Set instead of item when the workspace has no subscription: the purchase finishes in the app."
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
        - checkout
    CreateOauthClientRequest:
      type: object
      description: Request body of `create_oauth_client`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        redirect_uris:
          type: array
          items:
            type: string
            maxLength: 2048
            format: uri
            pattern: ^https:\/\/
          minItems: 1
          description: Exact-match https allow-list (at least one entry).
        permissions:
          type: array
          items:
            type: string
            maxLength: 128
          description: Unified permission ceiling the client may request.
        grant_types:
          type: array
          items:
            type: string
            enum:
              - authorization_code
              - refresh_token
          minItems: 1
          description: "Default: [authorization_code, refresh_token]."
        platform:
          type: boolean
          description: "Admin only: register a platform client (team_sid = null) instead of a team client."
        actor_kind:
          type: string
          enum:
            - agent
            - integration
          description: "Default for a hand-made client: integration. Pick agent when the tokens will act for an autonomous caller."
      required:
        - name
        - redirect_uris
        - permissions
    CreateOauthClientResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
              nullable: true
            name:
              type: string
            client_id:
              type: string
            redirect_uris:
              type: array
              items:
                type: string
            grant_types:
              type: array
              items:
                type: string
                enum:
                  - authorization_code
                  - refresh_token
            permissions:
              type: array
              items:
                type: string
            is_confidential:
              type: boolean
            registration_kind:
              type: string
              enum:
                - manual
                - dynamic
            actor_kind:
              type: string
              nullable: true
              enum:
                - agent
                - integration
              description: "What acts through the client: agent (an AI agent that registered itself or was registered as one) or integration (an app a person set up). Null = unclassified, a client from before the field (2026-08-02), never backfilled."
            status:
              type: string
              enum:
                - active
                - disabled
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            client_secret:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - client_id
            - redirect_uris
            - grant_types
            - permissions
            - is_confidential
            - registration_kind
            - actor_kind
            - status
            - created_by
            - created_at
            - updated_at
            - deleted_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    CreateSslCertificateRequest:
      type: object
      description: Request body of `create_ssl_certificate`.
      properties:
        domain:
          type: string
          maxLength: 253
          description: FQDN, e.g. "track.client.com"; lowercased server-side; unique among live rows.
      required:
        - domain
    CreateSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            domain:
              type: string
            status:
              type: string
              enum:
                - pending
                - challenge
                - active
                - failed
                - expired
            challenge:
              type: object
              nullable: true
              properties:
                type:
                  type: string
                  enum:
                    - http-01
                token:
                  type: string
                key_authorization:
                  type: string
                well_known_path:
                  type: string
                cname_target:
                  type: string
                expires_at:
                  type: string
                  nullable: true
              required:
                - type
                - token
                - key_authorization
                - well_known_path
                - cname_target
                - expires_at
            issuer:
              type: string
              nullable: true
            issued_at:
              type: string
              nullable: true
            expires_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            provider:
              type: string
              nullable: true
              description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
            cname_target:
              type: string
              nullable: true
              description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - domain
            - status
            - challenge
            - issuer
            - issued_at
            - expires_at
            - last_error
            - provider
            - cname_target
            - created_by
            - created_at
            - updated_at
            - deleted_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    CreateTeamMemberRequest:
      type: object
      description: Request body of `create_team_member`.
      properties:
        email:
          type: string
          maxLength: 255
          format: email
        permissions:
          type: array
          items:
            type: string
            enum:
              - can_view_teams
              - can_manage_teams
              - can_view_team_members
              - can_manage_team_members
              - can_view_api_keys
              - can_manage_api_keys
              - can_view_oauth_clients
              - can_manage_oauth_clients
              - can_view_sessions
              - can_manage_sessions
              - can_view_account_shares
              - can_manage_account_shares
              - can_manage_account_transfers
              - can_view_billing
              - can_manage_billing
              - can_view_ssl_certificates
              - can_manage_ssl_certificates
              - can_view_notifications
              - can_manage_notifications
              - can_view_support_requests
              - can_manage_support_requests
              - can_view_linkedin_connections
              - can_act_linkedin_connections
              - can_view_linkedin_messages
              - can_act_linkedin_messages
              - can_act_linkedin_engagements
              - can_view_linkedin_searches
              - can_act_linkedin_searches
              - can_view_linkedin_enrichment
              - can_act_linkedin_enrichment
              - can_view_linkedin_accounts
              - can_update_linkedin_accounts
              - can_manage_linkedin_accounts
              - can_open_cloud_browser
              - can_change_proxy
              - can_edit_schedule
              - can_manage_smart_limits
              - can_manage_cloud_browser_external_links
              - can_share_vendor_profiles
              - can_act_linkedin_custom_requests
              - can_view_mass_actions
              - can_manage_mass_actions
              - can_view_webhooks
              - can_manage_webhooks
              - can_view_email_accounts
              - can_update_email_accounts
              - can_manage_email_accounts
              - can_view_email_messages
              - can_act_email_messages
              - can_view_email_engagements
              - can_view_email_suppressions
              - can_manage_email_suppressions
              - can_view_email_tracking_domains
              - can_manage_email_tracking_domains
              - can_view_email_sending_domains
              - can_manage_email_sending_domains
              - "*"
          description: Unified catalog tokens, [] = membership only; the can_view_teams floor is always unioned in. This or preset, never both.
        preset:
          type: string
          enum:
            - operator
            - view_only
          description: "A named grant, expanded to its tokens: operator or view_only. This or permissions, never both."
        account_sids:
          type: array
          nullable: true
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ln_ac_
            description: "Connected-account sid (ln_ac_…): a member profile-slice entry."
          minItems: 1
          description: Profile slice; null/omitted = all team profiles. An empty list is refused (422).
      required:
        - email
    CreateTeamMemberResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
              nullable: true
            email:
              type: string
            status:
              type: string
              enum:
                - invited
                - active
                - revoked
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - user_sid
            - email
            - status
            - permissions
            - account_sids
            - created_by
            - created_at
            - updated_at
            - deleted_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    CreateTeamRequest:
      type: object
      description: Request body of `create_team`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        config:
          type: object
          nullable: true
          properties:
            timezone:
              type: string
              nullable: true
              description: IANA tz for team-scoped scheduling defaults.
          description: Optional workspace settings; default null.
      required:
        - name
    CreateTeamResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            subscription_sid:
              type: string
              nullable: true
            name:
              type: string
            status:
              type: string
              enum:
                - active
                - suspended
            plan:
              type: string
              nullable: true
              enum:
                - none
                - free
                - paid
                - partner
              description: "The plan kind, derived by the same recompute that writes status and limits: none, free, paid or partner. Null on a workspace that has not been recomputed since plans were stored; read it as unknown."
            cluster_id:
              type: integer
              description: "Which cluster holds the workspace's LinkedIn and calendar data, assigned once at create and never writable. A routing fact: nothing a caller sends depends on it."
            limits:
              type: object
              properties:
                accounts:
                  type: number
                cloud_browser:
                  type: number
                webhooks:
                  type: number
              required:
                - accounts
                - cloud_browser
                - webhooks
            config:
              type: object
              nullable: true
              properties:
                timezone:
                  type: string
                  nullable: true
                  description: IANA tz for team-scoped scheduling defaults.
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            data_deletion_at:
              type: string
              nullable: true
            deletion_warned_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - subscription_sid
            - name
            - status
            - plan
            - cluster_id
            - limits
            - config
            - created_by
            - created_at
            - updated_at
            - data_deletion_at
            - deletion_warned_at
            - deleted_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    DeleteApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteBillingPaymentMethodResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteEmailBoxResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
              description: The label the customer chose; "Server N" when nobody did.
            plan:
              type: string
              enum:
                - starter
                - growth
                - agency
                - dedicated
              description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
            location:
              type: string
              nullable: true
              enum:
                - hel1
                - fsn1
                - nbg1
              description: Null on a server older than the choice.
            status:
              type: string
              enum:
                - provisioning
                - active
                - suspended
                - resizing
                - destroying
                - destroyed
                - failed
              description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
            suspended_reason:
              type: string
              nullable: true
              enum:
                - payment_failed
                - unpaid
              description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
            destroy_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
            complimentary:
              type: boolean
              description: The server granted without a paid unit; it cannot be resized or deleted.
            seats_cap:
              type: integer
              minimum: 0
              description: Mailboxes the server can hold.
            seats_used:
              type: integer
              minimum: 0
              description: Mailboxes it holds now.
            ipv4:
              type: string
              nullable: true
            release:
              type: string
              nullable: true
              description: The gtm.service.email release the server runs.
            run:
              type: object
              nullable: true
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
              description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
            price:
              type: object
              nullable: true
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
            renews_at:
              type: string
              nullable: true
              description: The subscription's next billing date.
            paid_through:
              type: string
              nullable: true
              description: "Set by a delete: the end of the period the server was paid for."
            failed_error_code:
              type: string
              nullable: true
            created_at:
              type: string
              nullable: true
            provisioned_at:
              type: string
              nullable: true
            suspended_at:
              type: string
              nullable: true
            updated_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - plan
            - location
            - status
            - suspended_reason
            - complimentary
            - seats_cap
            - seats_used
            - ipv4
            - release
            - run
            - price
            - renews_at
            - paid_through
            - failed_error_code
            - created_at
            - provisioned_at
            - suspended_at
            - updated_at
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteNotificationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteOauthClientResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteTeamMemberResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        retained:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - retained
        - meta
    DeleteTeamResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - delete
        item:
          type: object
          additionalProperties: {}
        already_deleted:
          type: boolean
        soft_deleted:
          type: boolean
        cascade:
          type: object
          nullable: true
          properties:
            summary:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  entity:
                    type: string
                  deleted:
                    type: integer
                  cancelled:
                    type: integer
                required:
                  - entity
                  - deleted
            recovery_available_until:
              type: string
              nullable: true
          required:
            - summary
            - details
            - recovery_available_until
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_deleted
        - soft_deleted
        - cascade
        - meta
    EscalateToHumanRequest:
      type: object
      description: Request body of `escalate_to_human`.
      properties:
        subject:
          type: string
          minLength: 3
          maxLength: 255
          description: One-line issue title, in the user's language.
        body:
          type: string
          minLength: 10
          maxLength: 16000
          description: "The escalation the team will read: user's ask in their words + entities involved + what was tried. User's language for their words; English for the context block."
        reason:
          type: string
          enum:
            - user_requested
            - copilot_unable
            - other
          description: Default user_requested. Use copilot_unable when escalating on your own judgment.
        copilot_session_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^cp_ss_
          description: The current copilot session sid; pass it when escalating from a session (enables retry-dedup).
      required:
        - subject
        - body
    EscalateToHumanResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - create
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
            contact_email:
              type: string
            source:
              type: string
              enum:
                - copilot
                - app
            reason:
              type: string
              enum:
                - user_requested
                - copilot_unable
                - other
            subject:
              type: string
            body:
              type: string
            copilot_session_sid:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - received
                - handed_off
                - handoff_failed
            intercom_ticket_id:
              type: string
              nullable: true
            handed_off_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - team_sid
            - user_sid
            - contact_email
            - source
            - reason
            - subject
            - copilot_session_sid
            - status
            - intercom_ticket_id
            - handed_off_at
            - last_error
            - created_by
            - created_at
            - updated_at
        already_exists:
          type: boolean
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - already_exists
        - meta
    GetApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
            token_prefix:
              type: string
            token_last4:
              type: string
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
                - expired
            expires_at:
              type: string
              nullable: true
            last_used_at:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            plaintext_token:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - token_prefix
            - token_last4
            - permissions
            - account_sids
            - status
            - expires_at
            - last_used_at
            - created_by
            - created_at
            - updated_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetApiKeysMetricsRequest:
      type: object
      description: Request body of `get_api_keys_metrics`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                ne:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
              additionalProperties: false
            name:
              type: object
              properties:
                eq:
                  type: string
              additionalProperties: false
              description: Match on the human-readable key name.
            created_by_actor_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Issuer slice: keys created by this teammate (us_mb_) or parent key (id_ak_); offboarding."
            expires_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = perpetual keys; range = expiring-between.
            last_used_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = never used; lt = stale keys.
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
        period:
          type: object
          properties:
            from:
              type: string
              description: ISO 8601 UTC window start (inclusive).
            to:
              type: string
              description: ISO 8601 UTC window end; must be at or after from.
          required:
            - from
            - to
          description: Required metrics window [from, to).
        group_by:
          type: string
          nullable: true
          enum:
            - status
          description: Split the aggregate by key status instead of returning one total.
      required:
        - period
    GetApiKeysMetricsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - metrics
        metrics:
          type: object
          properties:
            filter:
              type: object
              additionalProperties: {}
            period:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - from
                - to
            aggregated:
              type: object
              properties:
                counts:
                  type: object
                  additionalProperties: {}
                metrics:
                  type: object
                  properties:
                    created_in_period:
                      type: number
                    expired_in_period:
                      type: number
                    last_used_at:
                      type: string
                      nullable: true
                  required:
                    - created_in_period
                    - expired_in_period
                    - last_used_at
            metrics:
              type: object
              properties:
                created_in_period:
                  type: number
                expired_in_period:
                  type: number
                last_used_at:
                  type: string
                  nullable: true
              required:
                - created_in_period
                - expired_in_period
                - last_used_at
        applied_filters:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - metrics
        - meta
    GetApiRequestMetricsRequest:
      type: object
      description: Request body of `get_api_request_metrics`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            service:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - id
                    - linkedin
                    - orchestration
                ne:
                  type: string
                  enum:
                    - id
                    - linkedin
                    - orchestration
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - id
                      - linkedin
                      - orchestration
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - id
                      - linkedin
                      - orchestration
              additionalProperties: false
              description: "Which answering service: id (keys, teams, billing), linkedin (the channel), orchestration (mass actions, webhooks). Excluded services are not asked."
            surface:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - api_key
                    - agent
                    - oauth_other
                ne:
                  type: string
                  enum:
                    - api_key
                    - agent
                    - oauth_other
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - agent
                      - oauth_other
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - agent
                      - oauth_other
              additionalProperties: false
              description: api_key = bearer keys (scripts, n8n); agent = OAuth clients of kind agent (Claude, Cursor); oauth_other = other OAuth clients.
            credential_kind:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - api_key
                    - oauth
                ne:
                  type: string
                  enum:
                    - api_key
                    - oauth
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - oauth
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - oauth
              additionalProperties: false
            client_sid:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "The credential: an api key sid (id_ak_*) or an OAuth client sid (id_oc_*). \"What did Claude do\" = that client's sid."
            actor_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The member an OAuth client delegates for (us_mb_*); is_null:true = api-key traffic.
            entity:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "The entity the route names, snake singular: linkedin_conversation, linkedin_message, mass_action, api_key."
            operation:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - get
                    - search
                    - metrics
                    - group_by
                    - create
                    - update
                    - delete
                    - action
                ne:
                  type: string
                  enum:
                    - get
                    - search
                    - metrics
                    - group_by
                    - create
                    - update
                    - delete
                    - action
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - get
                      - search
                      - metrics
                      - group_by
                      - create
                      - update
                      - delete
                      - action
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - get
                      - search
                      - metrics
                      - group_by
                      - create
                      - update
                      - delete
                      - action
              additionalProperties: false
            action_name:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The verb of an action route (send, run_now); is_null:true = the six canonical operations.
            route:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'The route key, exact: "POST api/linkedin-conversations/search".'
            account_sid:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: 'The account the request named (ln_ac_*, em_ac_*): "everything that was refused on this sender". is_null:true = calls that named no account.'
            status:
              type: object
              properties:
                eq:
                  type: integer
                ne:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
                nin:
                  type: array
                  items:
                    type: integer
                gte:
                  type: integer
                lte:
                  type: integer
                gt:
                  type: integer
                lt:
                  type: integer
              additionalProperties: false
            status_family:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - 2xx
                    - 3xx
                    - 4xx
                    - 5xx
                ne:
                  type: string
                  enum:
                    - 2xx
                    - 3xx
                    - 4xx
                    - 5xx
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - 2xx
                      - 3xx
                      - 4xx
                      - 5xx
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - 2xx
                      - 3xx
                      - 4xx
                      - 5xx
              additionalProperties: false
              description: 4xx and 5xx together are the errors every dashboard number counts.
            error_code:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The typed error code of the envelope that was returned (rate_limited, validation_failed, not_found); is_null:true = the calls that succeeded.
            error_reason:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "The sub-code inside error.context (bucket_saturated, account_rate_exceeded, not_connected): what a status alone cannot say."
            error_cause:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "The specific trigger a layered gate adds (held, daily_saturation, delay_not_elapsed, linkedin_quota_hit): held means a person paused the account, daily_saturation means the limit is spent, and a 429 does not tell them apart."
            occurred_at:
              type: object
              properties:
                eq:
                  type: string
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
              description: ISO 8601 UTC. The only time axis on search; ignored on metrics, where period is the window.
            trace_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: All the calls of one MCP turn share a trace id.
        period:
          type: object
          properties:
            from:
              type: string
              description: ISO 8601 UTC window start (inclusive).
            to:
              type: string
              description: ISO 8601 UTC window end (exclusive); at most 92 days after from.
          required:
            - from
            - to
          description: Required metrics window [from, to). Operators on occurred_at inside filter are ignored.
        group_by:
          type: string
          nullable: true
          enum:
            - service
            - surface
            - credential_kind
            - client_sid
            - entity
            - operation
            - route
            - status_family
            - occurred_day
            - occurred_hour
          description: "Split the aggregate per key: client_sid / route / entity / status_family / service / surface = breakdowns (occurred_hour / occurred_day = a legacy time split; prefer bucket). Cap 500 groups."
        bucket:
          type: string
          nullable: true
          enum:
            - hour
            - day
          description: "The time axis, independent of group_by: hour or day (UTC). Answers series.points[], one per bucket over the whole window, zeros filled, each with its own counts and group_by split."
      required:
        - period
    GetApiRequestMetricsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - metrics
        metrics:
          type: object
          properties:
            period:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - from
                - to
            aggregated:
              type: object
              properties:
                counts:
                  type: object
                  additionalProperties: {}
                metrics:
                  type: object
                  properties:
                    error_rate:
                      type: number
                      nullable: true
                      description: (4xx + 5xx) / total over the merged sources, 0..1; null when total is 0.
                    avg_duration_ms:
                      type: integer
                      nullable: true
                      description: Mean wall time of the rows that carry a duration; null when none.
                    first_occurred_at:
                      type: string
                      nullable: true
                      description: Earliest request in the window, ISO 8601 UTC.
                    last_occurred_at:
                      type: string
                      nullable: true
                      description: 'Latest request in the window: "when did my agent last call".'
                  required:
                    - error_rate
                    - avg_duration_ms
                    - first_occurred_at
                    - last_occurred_at
            groups:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                  label:
                    type: string
                  credential_kind:
                    type: string
                    enum:
                      - api_key
                      - oauth
                  counts:
                    type: object
                    additionalProperties: {}
                  metrics:
                    type: object
                    properties:
                      error_rate:
                        type: number
                        nullable: true
                        description: (4xx + 5xx) / total over the merged sources, 0..1; null when total is 0.
                      avg_duration_ms:
                        type: integer
                        nullable: true
                        description: Mean wall time of the rows that carry a duration; null when none.
                      first_occurred_at:
                        type: string
                        nullable: true
                        description: Earliest request in the window, ISO 8601 UTC.
                      last_occurred_at:
                        type: string
                        nullable: true
                        description: 'Latest request in the window: "when did my agent last call".'
                    required:
                      - error_rate
                      - avg_duration_ms
                      - first_occurred_at
                      - last_occurred_at
                required:
                  - key
                  - counts
                  - metrics
            series:
              type: object
              properties:
                bucket:
                  type: string
                  enum:
                    - hour
                    - day
                points:
                  type: array
                  items:
                    type: object
                    properties:
                      start:
                        type: string
                        description: The bucket start, ISO 8601 UTC.
                      counts:
                        type: object
                        properties:
                          total_count:
                            type: integer
                          error_count:
                            type: integer
                          groups:
                            type: object
                            properties:
                              status_family:
                                type: object
                                additionalProperties:
                                  type: integer
                            required:
                              - status_family
                        required:
                          - total_count
                          - error_count
                          - groups
                      groups:
                        type: object
                        additionalProperties:
                          type: object
                          properties:
                            total_count:
                              type: integer
                            error_count:
                              type: integer
                          required:
                            - total_count
                            - error_count
                        description: Per group_by key, this bucket only; empty when no group_by was passed.
                    required:
                      - start
                      - counts
                      - groups
              required:
                - bucket
                - points
              description: Present only when bucket was passed.
        applied_filters:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - metrics
        - meta
    GetBillingPaymentMethodAddLinkRequest:
      type: object
      description: Request body of `get_billing_payment_method_add_link`.
      properties:
        subscription_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_sb_
          description: The subscription the card is for (bl_sb_...); omitted = the one the workspace draws from.
    GetBillingPaymentMethodAddLinkResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            add_link:
              type: string
              nullable: true
            expires_at:
              type: string
            subscription_sid:
              type: string
          required:
            - add_link
            - expires_at
            - subscription_sid
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    GetBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetBillingSubscriptionUpdatePaymentMethodLinkResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    GetBillingTransactionInvoiceResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            subscription_sid:
              type: string
              nullable: true
            paddle_transaction_id:
              type: string
            status:
              type: string
              enum:
                - billed
                - paid
                - completed
                - past_due
                - canceled
            origin:
              type: string
              enum:
                - subscription_charge
                - subscription_update
                - one_time
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            invoice_number:
              type: string
              nullable: true
            total:
              type: string
            tax:
              type: string
              nullable: true
            currency:
              type: string
            items:
              type: array
              items:
                type: object
                properties:
                  price_sid:
                    type: string
                    nullable: true
                  product_sid:
                    type: string
                    nullable: true
                  product_type:
                    type: string
                    enum:
                      - plan
                      - addon
                      - credits_pack
                  quantity:
                    type: number
                  unit_amount:
                    type: string
                  paddle_price_id:
                    type: string
                    nullable: true
                required:
                  - price_sid
                  - product_sid
                  - product_type
                  - quantity
                  - unit_amount
                  - paddle_price_id
            billed_at:
              type: string
              nullable: true
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - owner_user_sid
            - team_sid
            - subscription_sid
            - paddle_transaction_id
            - status
            - origin
            - collection_mode
            - invoice_number
            - total
            - tax
            - currency
            - items
            - billed_at
            - created_at
            - updated_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    GetBillingTransactionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            subscription_sid:
              type: string
              nullable: true
            paddle_transaction_id:
              type: string
            status:
              type: string
              enum:
                - billed
                - paid
                - completed
                - past_due
                - canceled
            origin:
              type: string
              enum:
                - subscription_charge
                - subscription_update
                - one_time
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            invoice_number:
              type: string
              nullable: true
            total:
              type: string
            tax:
              type: string
              nullable: true
            currency:
              type: string
            items:
              type: array
              items:
                type: object
                properties:
                  price_sid:
                    type: string
                    nullable: true
                  product_sid:
                    type: string
                    nullable: true
                  product_type:
                    type: string
                    enum:
                      - plan
                      - addon
                      - credits_pack
                  quantity:
                    type: number
                  unit_amount:
                    type: string
                  paddle_price_id:
                    type: string
                    nullable: true
                required:
                  - price_sid
                  - product_sid
                  - product_type
                  - quantity
                  - unit_amount
                  - paddle_price_id
            billed_at:
              type: string
              nullable: true
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - owner_user_sid
            - team_sid
            - subscription_sid
            - paddle_transaction_id
            - status
            - origin
            - collection_mode
            - invoice_number
            - total
            - tax
            - currency
            - items
            - billed_at
            - created_at
            - updated_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetBillingTransactionsMetricsRequest:
      type: object
      description: Request body of `get_billing_transactions_metrics`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            subscription_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            paddle_transaction_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            invoice_number:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - billed
                    - paid
                    - completed
                    - past_due
                    - canceled
                ne:
                  type: string
                  enum:
                    - billed
                    - paid
                    - completed
                    - past_due
                    - canceled
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - billed
                      - paid
                      - completed
                      - past_due
                      - canceled
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - billed
                      - paid
                      - completed
                      - past_due
                      - canceled
              additionalProperties: false
            origin:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - subscription_charge
                    - subscription_update
                    - one_time
                ne:
                  type: string
                  enum:
                    - subscription_charge
                    - subscription_update
                    - one_time
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - subscription_charge
                      - subscription_update
                      - one_time
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - subscription_charge
                      - subscription_update
                      - one_time
              additionalProperties: false
            collection_mode:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - automatic
                    - manual
                ne:
                  type: string
                  enum:
                    - automatic
                    - manual
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - automatic
                      - manual
              additionalProperties: false
            currency:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            billed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
        period:
          type: object
          properties:
            from:
              type: string
              description: ISO 8601 UTC window start (inclusive).
            to:
              type: string
              description: ISO 8601 UTC window end; must be ≥ from.
          required:
            - from
            - to
          description: Required metrics window [from, to].
      required:
        - period
    GetBillingTransactionsMetricsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - metrics
        metrics:
          type: object
          properties:
            filter:
              type: object
              additionalProperties: {}
            period:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - from
                - to
            aggregated:
              type: object
              properties:
                counts:
                  type: object
                  additionalProperties: {}
                metrics:
                  type: object
                  properties: {}
            metrics:
              type: object
              properties: {}
        applied_filters:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - metrics
        - meta
    GetCurrentUserResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            default_team_sid:
              type: string
              nullable: true
            email:
              type: string
            email_status:
              type: string
              enum:
                - unverified
                - verified
            auth_provider:
              type: string
              enum:
                - password
                - google
            first_name:
              type: string
            last_name:
              type: string
              nullable: true
            avatar_url:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
            timezone:
              type: string
              nullable: true
            country:
              type: string
              nullable: true
            config:
              type: object
              nullable: true
              properties:
                latest_team_sid:
                  type: string
                  nullable: true
                  description: Which workspace to open on load (ts_tm_…); NOT default_team_sid.
                setup_completed:
                  type: boolean
                  description: The post-signup wizard is finished (or its last step was skipped).
                setup_step:
                  type: string
                  nullable: true
                  enum:
                    - verify
                    - questions
                    - workspace
                    - linkedin
                    - call
                  description: Resume point inside the wizard; null = not started.
                setup_call_step:
                  type: boolean
                  nullable: true
                  description: "Read-only. Whether this user's wizard includes step 04 (intro call): null = not scored yet, so it is offered. Server-computed from the step 02 sender bracket; silently dropped if sent to update."
                onboarding_completed:
                  type: boolean
                onboarding_steps:
                  type: array
                  items:
                    type: string
                locale:
                  type: string
                  nullable: true
                  maxLength: 8
            utm:
              type: object
              nullable: true
              additionalProperties:
                type: string
            created_at:
              type: string
            updated_at:
              type: string
            erasure_requested_at:
              type: string
              nullable: true
            erased_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - default_team_sid
            - email
            - email_status
            - auth_provider
            - first_name
            - last_name
            - avatar_url
            - phone
            - timezone
            - country
            - config
            - utm
            - created_at
            - updated_at
            - erasure_requested_at
            - erased_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetNotificationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
              nullable: true
            event_name:
              type: string
            event_sid:
              type: string
            entity_sid:
              type: string
              nullable: true
            channel:
              type: string
              enum:
                - email
                - in_app
            status:
              type: string
              enum:
                - pending
                - delivered
                - failed
            subject:
              type: string
            body_html:
              type: string
            body_text:
              type: string
            rate_limit_bucket:
              type: string
            scheduled_at:
              type: string
            delivered_at:
              type: string
              nullable: true
            failed_at:
              type: string
              nullable: true
            failure_reason:
              type: string
              nullable: true
            read_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC: when the recipient read an in-app notification. Every notification this platform writes is an email, so it is null here and no verb marks one read."
            retry_count:
              type: number
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - user_sid
            - event_name
            - event_sid
            - entity_sid
            - channel
            - status
            - subject
            - rate_limit_bucket
            - scheduled_at
            - delivered_at
            - failed_at
            - failure_reason
            - read_at
            - retry_count
            - created_by
            - created_at
            - updated_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetNotificationsMetricsRequest:
      type: object
      description: Request body of `get_notifications_metrics`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Scoped by JWT; explicit override only for internal-support.
            user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Recipient: \"show me Joe's notifications\"."
            event_name:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: e.g. linkedin-accounts.logged-out.
            read_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = unread.
            entity_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The domain entity a notification is about (e.g. a linkedin_account sid).
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - delivered
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - delivered
                      - failed
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - email
                    - in_app
              additionalProperties: false
            scheduled_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            delivered_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = not yet delivered.
            failed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (undismissed rows)."
        period:
          type: object
          properties:
            from:
              type: string
              description: ISO 8601 UTC window start (inclusive).
            to:
              type: string
              description: ISO 8601 UTC window end (exclusive); must be after from.
          required:
            - from
            - to
          description: Required metrics window [from, to).
        group_by:
          type: string
          enum:
            - event_name
            - status
            - channel
          description: Optional single split axis.
      required:
        - period
    GetNotificationsMetricsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - metrics
        metrics:
          type: object
          properties:
            filter:
              type: object
              additionalProperties: {}
            period:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - from
                - to
            aggregated:
              type: object
              properties:
                counts:
                  type: object
                  additionalProperties: {}
                metrics:
                  type: object
                  properties: {}
            metrics:
              type: object
              properties: {}
        applied_filters:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - metrics
        - meta
    GetOauthClientResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
              nullable: true
            name:
              type: string
            client_id:
              type: string
            redirect_uris:
              type: array
              items:
                type: string
            grant_types:
              type: array
              items:
                type: string
                enum:
                  - authorization_code
                  - refresh_token
            permissions:
              type: array
              items:
                type: string
            is_confidential:
              type: boolean
            registration_kind:
              type: string
              enum:
                - manual
                - dynamic
            actor_kind:
              type: string
              nullable: true
              enum:
                - agent
                - integration
              description: "What acts through the client: agent (an AI agent that registered itself or was registered as one) or integration (an app a person set up). Null = unclassified, a client from before the field (2026-08-02), never backfilled."
            status:
              type: string
              enum:
                - active
                - disabled
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            client_secret:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - client_id
            - redirect_uris
            - grant_types
            - permissions
            - is_confidential
            - registration_kind
            - actor_kind
            - status
            - created_by
            - created_at
            - updated_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            domain:
              type: string
            status:
              type: string
              enum:
                - pending
                - challenge
                - active
                - failed
                - expired
            challenge:
              type: object
              nullable: true
              properties:
                type:
                  type: string
                  enum:
                    - http-01
                token:
                  type: string
                key_authorization:
                  type: string
                well_known_path:
                  type: string
                cname_target:
                  type: string
                expires_at:
                  type: string
                  nullable: true
              required:
                - type
                - token
                - key_authorization
                - well_known_path
                - cname_target
                - expires_at
            issuer:
              type: string
              nullable: true
            issued_at:
              type: string
              nullable: true
            expires_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            provider:
              type: string
              nullable: true
              description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
            cname_target:
              type: string
              nullable: true
              description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - domain
            - status
            - challenge
            - issuer
            - issued_at
            - expires_at
            - last_error
            - provider
            - cname_target
            - created_by
            - created_at
            - updated_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetSupportRequestResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
            contact_email:
              type: string
            source:
              type: string
              enum:
                - copilot
                - app
            reason:
              type: string
              enum:
                - user_requested
                - copilot_unable
                - other
            subject:
              type: string
            body:
              type: string
            copilot_session_sid:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - received
                - handed_off
                - handoff_failed
            intercom_ticket_id:
              type: string
              nullable: true
            handed_off_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - team_sid
            - user_sid
            - contact_email
            - source
            - reason
            - subject
            - copilot_session_sid
            - status
            - intercom_ticket_id
            - handed_off_at
            - last_error
            - created_by
            - created_at
            - updated_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    GetTeamResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - get
        item:
          type: object
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            subscription_sid:
              type: string
              nullable: true
            name:
              type: string
            status:
              type: string
              enum:
                - active
                - suspended
            plan:
              type: string
              nullable: true
              enum:
                - none
                - free
                - paid
                - partner
              description: "The plan kind, derived by the same recompute that writes status and limits: none, free, paid or partner. Null on a workspace that has not been recomputed since plans were stored; read it as unknown."
            cluster_id:
              type: integer
              description: "Which cluster holds the workspace's LinkedIn and calendar data, assigned once at create and never writable. A routing fact: nothing a caller sends depends on it."
            limits:
              type: object
              properties:
                accounts:
                  type: number
                cloud_browser:
                  type: number
                webhooks:
                  type: number
              required:
                - accounts
                - cloud_browser
                - webhooks
            config:
              type: object
              nullable: true
              properties:
                timezone:
                  type: string
                  nullable: true
                  description: IANA tz for team-scoped scheduling defaults.
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            data_deletion_at:
              type: string
              nullable: true
            deletion_warned_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - subscription_sid
            - name
            - status
            - plan
            - cluster_id
            - limits
            - config
            - created_by
            - created_at
            - updated_at
            - data_deletion_at
            - deletion_warned_at
            - deleted_at
        included:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - included
        - includes
        - meta
    IssueSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
        async:
          type: boolean
          enum:
            - true
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            domain:
              type: string
            status:
              type: string
              enum:
                - pending
                - challenge
                - active
                - failed
                - expired
            challenge:
              type: object
              nullable: true
              properties:
                type:
                  type: string
                  enum:
                    - http-01
                token:
                  type: string
                key_authorization:
                  type: string
                well_known_path:
                  type: string
                cname_target:
                  type: string
                expires_at:
                  type: string
                  nullable: true
              required:
                - type
                - token
                - key_authorization
                - well_known_path
                - cname_target
                - expires_at
            issuer:
              type: string
              nullable: true
            issued_at:
              type: string
              nullable: true
            expires_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            provider:
              type: string
              nullable: true
              description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
            cname_target:
              type: string
              nullable: true
              description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - domain
            - status
            - challenge
            - issuer
            - issued_at
            - expires_at
            - last_error
            - provider
            - cname_target
            - created_by
            - created_at
            - updated_at
            - deleted_at
        pending:
          type: array
          items:
            type: object
            properties:
              activity_log_sid:
                type: string
              expected_completion_seconds:
                type: integer
                minimum: 0
              webhook_events:
                type: array
                items:
                  type: string
            required:
              - expected_completion_seconds
              - webhook_events
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - async
        - item
        - pending
        - result
        - meta
    ListBillingPaymentMethodsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  type:
                    type: string
                    enum:
                      - card
                      - paypal
                      - apple_pay
                      - google_pay
                      - other
                  card_brand:
                    type: string
                    nullable: true
                  card_last4:
                    type: string
                    nullable: true
                  card_expiry:
                    type: string
                    nullable: true
                  is_default:
                    type: boolean
                  origin:
                    type: string
                    nullable: true
                  saved_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - type
                  - card_brand
                  - card_last4
                  - card_expiry
                  - is_default
                  - origin
                  - saved_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          additionalProperties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    ListReceivedAccountSharesRequest:
      type: object
      description: Request body of `list_received_account_shares`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - linkedin
                    - email
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - linkedin
                      - email
              additionalProperties: false
              description: '"My LinkedIn loans" vs "my email loans".'
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                ne:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
              additionalProperties: false
              description: 'The phase. { eq: "active" } is the live set; { in: ["rolling_back","failed"] } is the loans that gave up.'
            to_team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Owner side question: everything lent to team X."
            to_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'Share history of an owned account: "is this account lent out, and to whom".'
            holder_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Holder side question: map a borrowed copy back to its loan."
            holder_over_slot:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
              description: Which loans reached active but landed with no free slot on the holder side.
            end_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - returned_by_holder
                    - recalled_by_owner
                    - holder_deleted_copy
                    - holder_team_purged
                    - owner_team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            failure_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - park_failed
                    - export_failed
                    - copy_refused
                    - probe_stale
                    - team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            owner_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            holder_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            phase_claimed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            planned_return_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "{ is_null: true } is an open ended lend."
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
        include:
          type: array
          items:
            type: string
            enum:
              - counterparty_team
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - planned_return_at
                - updated_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 200
          description: 0..200, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    ListReceivedAccountSharesResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                    description: "The OWNER team: the row tenant, the side that lent the account out."
                  channel:
                    type: string
                    enum:
                      - linkedin
                      - email
                    description: Which channel service owns the physical account pair.
                  to_team_sid:
                    type: string
                    description: "The HOLDER team: the side that borrowed the account."
                  to_user_sid:
                    type: string
                    nullable: true
                    description: Resolved user when the share was targeted by email; null when targeted by team sid.
                  to_email:
                    type: string
                    nullable: true
                    description: The targeting input kept for audit; null when targeted by team sid.
                  owner_cluster_id:
                    type: integer
                  holder_cluster_id:
                    type: integer
                  owner_account_sid:
                    type: string
                    description: "The owner's channel account row, parked for the duration of the loan. Prefix agnostic: ln_ac_ on LinkedIn, em_ac_ on email."
                  owner_channel_ref:
                    type: string
                    nullable: true
                    description: Opaque second row the channel needs to name (LinkedIn puts its ab_br_ browser sid here); null when the channel needs none.
                  holder_account_sid:
                    type: string
                    nullable: true
                    description: The holder's copy. NULL until the copy phase lands, so it is null on every pre-active row.
                  holder_channel_ref:
                    type: string
                    nullable: true
                  owner_account_label:
                    type: string
                    nullable: true
                    description: "The channel's display name for the lent account, e.g. \"Jane Roe (jane-roe)\". Use it to tell one share from another when reporting to a human. Null when the channel had no name to give. Display only: never filter, match or reason on it."
                  status:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                    description: The durable phase, and the answer to "did the loan start". Only active means the holder can work.
                  holder_over_slot:
                    type: boolean
                    description: True when the holder had no free account slot at create, so the copy landed in the channel's subscription hold. The loan still reaches active; the holder cannot work until it upgrades.
                  end_reason:
                    type: string
                    nullable: true
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                    description: Stamped when an ending is REQUESTED. Only ever set on a row that reached active.
                  failure_reason:
                    type: string
                    nullable: true
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                    description: Why a pre-active phase gave up. Non null on exactly rolling_back and failed.
                  planned_return_at:
                    type: string
                    nullable: true
                    description: Informational only. When it passes the owner is emailed a recall link once; there is NO auto return.
                  expiry_notified_at:
                    type: string
                    nullable: true
                  phase_claimed_at:
                    type: string
                    nullable: true
                  phase_attempts:
                    type: integer
                    description: Attempts on the CURRENT phase, reset on every advance. A large and growing value is the stuck signal on a phase that may not give up.
                  ended_at:
                    type: string
                    nullable: true
                  ended_by:
                    type: object
                    nullable: true
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                    description: Who ended it. The machine readable why is end_reason (an ending) or failure_reason (a failure), never this blob.
                  created_by:
                    type: object
                    nullable: true
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - sid
                  - team_sid
                  - channel
                  - to_team_sid
                  - to_user_sid
                  - to_email
                  - owner_cluster_id
                  - holder_cluster_id
                  - owner_account_sid
                  - owner_channel_ref
                  - holder_account_sid
                  - holder_channel_ref
                  - owner_account_label
                  - status
                  - holder_over_slot
                  - end_reason
                  - failure_reason
                  - planned_return_at
                  - expiry_notified_at
                  - phase_claimed_at
                  - phase_attempts
                  - ended_at
                  - ended_by
                  - created_by
                  - created_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          additionalProperties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    McpError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_failed
                - nothing_to_update
                - not_found
                - relation_not_found
                - invalid_transition
                - limit_exceeded
                - payment_required
                - duplicate_rejected
                - conflict
                - delete_blocked
                - unauthorized
                - forbidden
                - rate_limited
                - internal_error
                - service_unavailable
                - not_implemented
            message:
              type: string
            recoverable:
              type: boolean
            suggestion:
              type: string
            field_errors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: object
                  properties:
                    rule:
                      type: string
                    message:
                      type: string
                  required:
                    - rule
                    - message
            blockers:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    description: Machine-readable blocker type (active_flow, pending_tasks, …).
                  severity:
                    type: string
                    enum:
                      - hard
                      - soft
                    description: hard = external action required; soft = acknowledge is enough.
                  description:
                    type: string
                  entity_sid:
                    type: string
                    nullable: true
                  count:
                    type: integer
                  resolution:
                    type: string
                    description: "Hard: tool name to call. Soft: code for acknowledge[]."
                  resolution_hint:
                    type: string
                required:
                  - type
                  - severity
                  - description
                  - entity_sid
                  - resolution
                  - resolution_hint
            context:
              type: object
              additionalProperties: {}
          required:
            - code
            - message
            - recoverable
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - error
    MoveInEmailBoxMailboxesRequest:
      type: object
      description: Request body of `move_in_email_box_mailboxes`.
      properties:
        from_email_box_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^em_bx_
          description: The server that holds them now (em_bx_...).
        email_account_sids:
          type: array
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^em_ac_
          minItems: 1
          maxItems: 100
          description: The mailboxes to move (em_ac_...), 1 to 100, no repeats.
      required:
        - from_email_box_sid
        - email_account_sids
    MoveInEmailBoxMailboxesResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            run:
              type: object
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
          required:
            - run
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    PauseBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    PreviewBillingSubscriptionChangeRequest:
      type: object
      description: Request body of `preview_billing_subscription_change`.
      properties:
        quantity:
          type: integer
          minimum: 1
          description: Proposed new slot count (re-bracketed automatically).
        price_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_pc_
          description: Explicit target bracket price; usually resolved from quantity.
    PreviewBillingSubscriptionChangeResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    PreviewEmailBoxCreateRequest:
      type: object
      description: Request body of `preview_email_box_create`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The server's label, 1 to 60 characters.
        plan:
          type: string
          enum:
            - starter
            - growth
            - agency
            - dedicated
          description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
        location:
          type: string
          enum:
            - hel1
            - fsn1
            - nbg1
          description: hel1 Helsinki, fsn1 Falkenstein, nbg1 Nuremberg.
        copy_settings_from:
          type: string
          nullable: true
          minLength: 18
          maxLength: 18
          pattern: ^em_bx_
          description: A serving server of this workspace whose settings and stop-list the new one starts with.
      required:
        - name
        - plan
        - location
    PreviewEmailBoxCreateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            payment:
              type: string
              description: "charged_now: the unit joins the live subscription and amount_due_now goes to its card in the purchase. checkout: no live subscription, the purchase charges nothing and answers a Paddle checkout only the app can open. kept_seat: a seat kept from a deleted server of the plan pays, nothing is charged."
            amount_due_now:
              type: object
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
              required:
                - amount
                - currency
              description: Charged by the purchase itself, prorated for the rest of the period; 0.00 for checkout and kept_seat.
            next_amount:
              type: object
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The recurring price of the server; with checkout, what the checkout asks for before tax.
            available:
              type: boolean
              description: "false: the plan's machine cannot be had right now, and the confirmed call would refuse with nothing charged."
            unavailable_reason:
              type: string
              nullable: true
              description: "out_of_stock: no capacity for the plan's machine type where the server would be. disk_does_not_shrink: a change down in place after the server's disk grew. stock_unknown: the check got no answer. Null when available."
          required:
            - payment
            - amount_due_now
            - next_amount
            - available
            - unavailable_reason
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    PreviewEmailBoxResizeRequest:
      type: object
      description: Request body of `preview_email_box_resize`.
      properties:
        plan:
          type: string
          enum:
            - starter
            - growth
            - agency
            - dedicated
          description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
      required:
        - plan
    PreviewEmailBoxResizeResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            fits:
              type: boolean
              description: "false: the server holds more mailboxes than the plan's cap, and the change would be refused."
            seats_used:
              type: integer
              minimum: 0
            seats_cap_after:
              type: integer
              minimum: 0
            amount_due_now:
              type: object
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
              required:
                - amount
                - currency
              description: Charged in the change (prorated for the rest of the period); a downgrade is credited instead.
            next_amount:
              type: object
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The recurring price of the server from the next period on.
            available:
              type: boolean
              description: "false: the plan's machine cannot be had right now, and the confirmed call would refuse with nothing charged."
            unavailable_reason:
              type: string
              nullable: true
              description: "out_of_stock: no capacity for the plan's machine type where the server would be. disk_does_not_shrink: a change down in place after the server's disk grew. stock_unknown: the check got no answer. Null when available."
          required:
            - fits
            - seats_used
            - seats_cap_after
            - amount_due_now
            - next_amount
            - available
            - unavailable_reason
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RecallAccountShareRequest:
      type: object
      description: Request body of `recall_account_share`.
      properties:
        sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^ac_sh_
          description: Single-share mode. Mutually exclusive with filter.
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - linkedin
                    - email
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - linkedin
                      - email
              additionalProperties: false
              description: '"My LinkedIn loans" vs "my email loans".'
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                ne:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
              additionalProperties: false
              description: 'The phase. { eq: "active" } is the live set; { in: ["rolling_back","failed"] } is the loans that gave up.'
            to_team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Owner side question: everything lent to team X."
            to_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'Share history of an owned account: "is this account lent out, and to whom".'
            holder_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Holder side question: map a borrowed copy back to its loan."
            holder_over_slot:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
              description: Which loans reached active but landed with no free slot on the holder side.
            end_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - returned_by_holder
                    - recalled_by_owner
                    - holder_deleted_copy
                    - holder_team_purged
                    - owner_team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            failure_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - park_failed
                    - export_failed
                    - copy_refused
                    - probe_stale
                    - team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            owner_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            holder_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            phase_claimed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            planned_return_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "{ is_null: true } is an open ended lend."
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
          description: Mass-target mode, resolved against the loans you ISSUED. status is overwritten with eq active server side, so it cannot be widened. Mutually exclusive with sid.
        confirmation_count:
          type: integer
          minimum: 0
          description: Blast-radius confirmation, REQUIRED with filter and ignored with sid. Must equal the active-pinned pagination.total_count of the same filter from search_account_shares; a mismatch is 409, not a partial run.
    RecallAccountShareResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
              description: "The OWNER team: the row tenant, the side that lent the account out."
            channel:
              type: string
              enum:
                - linkedin
                - email
              description: Which channel service owns the physical account pair.
            to_team_sid:
              type: string
              description: "The HOLDER team: the side that borrowed the account."
            to_user_sid:
              type: string
              nullable: true
              description: Resolved user when the share was targeted by email; null when targeted by team sid.
            to_email:
              type: string
              nullable: true
              description: The targeting input kept for audit; null when targeted by team sid.
            owner_cluster_id:
              type: integer
            holder_cluster_id:
              type: integer
            owner_account_sid:
              type: string
              description: "The owner's channel account row, parked for the duration of the loan. Prefix agnostic: ln_ac_ on LinkedIn, em_ac_ on email."
            owner_channel_ref:
              type: string
              nullable: true
              description: Opaque second row the channel needs to name (LinkedIn puts its ab_br_ browser sid here); null when the channel needs none.
            holder_account_sid:
              type: string
              nullable: true
              description: The holder's copy. NULL until the copy phase lands, so it is null on every pre-active row.
            holder_channel_ref:
              type: string
              nullable: true
            owner_account_label:
              type: string
              nullable: true
              description: "The channel's display name for the lent account, e.g. \"Jane Roe (jane-roe)\". Use it to tell one share from another when reporting to a human. Null when the channel had no name to give. Display only: never filter, match or reason on it."
            status:
              type: string
              enum:
                - pending
                - owner_parked
                - active
                - closing
                - holder_released
                - rolling_back
                - returned
                - recalled
                - failed
              description: The durable phase, and the answer to "did the loan start". Only active means the holder can work.
            holder_over_slot:
              type: boolean
              description: True when the holder had no free account slot at create, so the copy landed in the channel's subscription hold. The loan still reaches active; the holder cannot work until it upgrades.
            end_reason:
              type: string
              nullable: true
              enum:
                - returned_by_holder
                - recalled_by_owner
                - holder_deleted_copy
                - holder_team_purged
                - owner_team_purged
              description: Stamped when an ending is REQUESTED. Only ever set on a row that reached active.
            failure_reason:
              type: string
              nullable: true
              enum:
                - park_failed
                - export_failed
                - copy_refused
                - probe_stale
                - team_purged
              description: Why a pre-active phase gave up. Non null on exactly rolling_back and failed.
            planned_return_at:
              type: string
              nullable: true
              description: Informational only. When it passes the owner is emailed a recall link once; there is NO auto return.
            expiry_notified_at:
              type: string
              nullable: true
            phase_claimed_at:
              type: string
              nullable: true
            phase_attempts:
              type: integer
              description: Attempts on the CURRENT phase, reset on every advance. A large and growing value is the stuck signal on a phase that may not give up.
            ended_at:
              type: string
              nullable: true
            ended_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
              description: Who ended it. The machine readable why is end_reason (an ending) or failure_reason (a failure), never this blob.
            created_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - team_sid
            - channel
            - to_team_sid
            - to_user_sid
            - to_email
            - owner_cluster_id
            - holder_cluster_id
            - owner_account_sid
            - owner_channel_ref
            - holder_account_sid
            - holder_channel_ref
            - owner_account_label
            - status
            - holder_over_slot
            - end_reason
            - failure_reason
            - planned_return_at
            - expiry_notified_at
            - phase_claimed_at
            - phase_attempts
            - ended_at
            - ended_by
            - created_by
            - created_at
            - updated_at
        result:
          type: object
          properties:
            closing_count:
              type: integer
              minimum: 0
              description: Shares this call stamped closing. The teardown is the driver's, so this is never "recalled" or "returned".
            total_matched:
              type: integer
              minimum: 0
              description: True count of active shares the target set held. closing_count below this means a remainder is left; re-read the count before the next call.
          required:
            - closing_count
            - total_matched
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RemoveBillingSubscriptionAddonRequest:
      type: object
      description: Request body of `remove_billing_subscription_addon`.
      properties:
        price_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^bl_pc_
          description: The add-on price to remove; must be a live item on this subscription.
        quantity:
          type: integer
          minimum: 1
          description: Units to give back (delta, mirrors add_billing_subscription_addon). Omit to drop the whole line.
      required:
        - price_sid
    RemoveBillingSubscriptionAddonResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RenewSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
        async:
          type: boolean
          enum:
            - true
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            domain:
              type: string
            status:
              type: string
              enum:
                - pending
                - challenge
                - active
                - failed
                - expired
            challenge:
              type: object
              nullable: true
              properties:
                type:
                  type: string
                  enum:
                    - http-01
                token:
                  type: string
                key_authorization:
                  type: string
                well_known_path:
                  type: string
                cname_target:
                  type: string
                expires_at:
                  type: string
                  nullable: true
              required:
                - type
                - token
                - key_authorization
                - well_known_path
                - cname_target
                - expires_at
            issuer:
              type: string
              nullable: true
            issued_at:
              type: string
              nullable: true
            expires_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            provider:
              type: string
              nullable: true
              description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
            cname_target:
              type: string
              nullable: true
              description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - domain
            - status
            - challenge
            - issuer
            - issued_at
            - expires_at
            - last_error
            - provider
            - cname_target
            - created_by
            - created_at
            - updated_at
            - deleted_at
        pending:
          type: array
          items:
            type: object
            properties:
              activity_log_sid:
                type: string
              expected_completion_seconds:
                type: integer
                minimum: 0
              webhook_events:
                type: array
                items:
                  type: string
            required:
              - expected_completion_seconds
              - webhook_events
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - async
        - item
        - pending
        - result
        - meta
    RequestMediaUploadRequest:
      type: object
      description: Request body of `request_media_upload`.
      properties:
        purpose:
          type: string
          enum:
            - post_media
          description: "What the file is for. post_media (the default): an image or video for create_linkedin_post."
        file_name:
          type: string
          minLength: 1
          maxLength: 200
          description: Optional file name, e.g. "q3-chart.png". Characters outside A-Z a-z 0-9 . _ - become "-" in the stored name. Omit when you do not know it yet.
        file_type:
          type: string
          enum:
            - image/png
            - image/jpeg
            - image/gif
            - image/webp
            - video/mp4
            - video/quicktime
            - video/webm
          description: "Optional MIME type, one the purpose takes. Given, it also mints the pre-signed S3 form with this Content-Type bound in. The upload_link needs no type: it reads it from the file."
    RequestMediaUploadResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item: {}
        result:
          type: object
          properties:
            purpose:
              type: string
              description: What the slot is for (post_media today); it decides the accepted file types.
            upload_link:
              type: string
              description: One-time link on our domain, valid until upload_expires_at. A person opens it in a browser and drops the file; a shell sends it with the curl line. Accepts one successful upload.
            upload:
              type: object
              nullable: true
              properties:
                url:
                  type: string
                  description: The S3 form action to POST to.
                method:
                  type: string
                  enum:
                    - POST
                enctype:
                  type: string
                  enum:
                    - multipart/form-data
                fields:
                  type: object
                  additionalProperties:
                    type: string
                  description: Send EVERY entry verbatim as a form field, before the file.
                file_field:
                  type: string
                  enum:
                    - file
                  description: The form field that carries the bytes; it must be the LAST part of the form.
              required:
                - url
                - method
                - enctype
                - fields
                - file_field
              description: A pre-signed S3 POST form for the same object, only when file_type was given; null otherwise.
            file_url:
              type: string
              description: "The object's public https URL once uploaded: pass it as images[].url or video.url."
            upload_expires_at:
              type: string
              description: "ISO 8601: the form refuses uploads after this."
            retained_until:
              type: string
              description: "ISO 8601: the object is deleted after this."
            max_byte_size:
              type: integer
              description: The largest file the form accepts, in bytes.
            curl:
              type: string
              description: "A ready upload command through upload_link: replace <path> with the local file path. Answers 201 with the stored type and size."
          required:
            - purpose
            - upload_link
            - upload
            - file_url
            - upload_expires_at
            - retained_until
            - max_byte_size
            - curl
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ResendTeamMemberInvitationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
              nullable: true
            email:
              type: string
            status:
              type: string
              enum:
                - invited
                - active
                - revoked
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - user_sid
            - email
            - status
            - permissions
            - account_sids
            - created_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ResizeEmailBoxRequest:
      type: object
      description: Request body of `resize_email_box`.
      properties:
        plan:
          type: string
          enum:
            - starter
            - growth
            - agency
            - dedicated
          description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
      required:
        - plan
    ResizeEmailBoxResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
              description: The label the customer chose; "Server N" when nobody did.
            plan:
              type: string
              enum:
                - starter
                - growth
                - agency
                - dedicated
              description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
            location:
              type: string
              nullable: true
              enum:
                - hel1
                - fsn1
                - nbg1
              description: Null on a server older than the choice.
            status:
              type: string
              enum:
                - provisioning
                - active
                - suspended
                - resizing
                - destroying
                - destroyed
                - failed
              description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
            suspended_reason:
              type: string
              nullable: true
              enum:
                - payment_failed
                - unpaid
              description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
            destroy_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
            complimentary:
              type: boolean
              description: The server granted without a paid unit; it cannot be resized or deleted.
            seats_cap:
              type: integer
              minimum: 0
              description: Mailboxes the server can hold.
            seats_used:
              type: integer
              minimum: 0
              description: Mailboxes it holds now.
            ipv4:
              type: string
              nullable: true
            release:
              type: string
              nullable: true
              description: The gtm.service.email release the server runs.
            run:
              type: object
              nullable: true
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
              description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
            price:
              type: object
              nullable: true
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
            renews_at:
              type: string
              nullable: true
              description: The subscription's next billing date.
            paid_through:
              type: string
              nullable: true
              description: "Set by a delete: the end of the period the server was paid for."
            failed_error_code:
              type: string
              nullable: true
            created_at:
              type: string
              nullable: true
            provisioned_at:
              type: string
              nullable: true
            suspended_at:
              type: string
              nullable: true
            updated_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - plan
            - location
            - status
            - suspended_reason
            - complimentary
            - seats_cap
            - seats_used
            - ipv4
            - release
            - run
            - price
            - renews_at
            - paid_through
            - failed_error_code
            - created_at
            - provisioned_at
            - suspended_at
            - updated_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ResumeBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RetryEmailBoxRunResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
              description: The label the customer chose; "Server N" when nobody did.
            plan:
              type: string
              enum:
                - starter
                - growth
                - agency
                - dedicated
              description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
            location:
              type: string
              nullable: true
              enum:
                - hel1
                - fsn1
                - nbg1
              description: Null on a server older than the choice.
            status:
              type: string
              enum:
                - provisioning
                - active
                - suspended
                - resizing
                - destroying
                - destroyed
                - failed
              description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
            suspended_reason:
              type: string
              nullable: true
              enum:
                - payment_failed
                - unpaid
              description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
            destroy_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
            complimentary:
              type: boolean
              description: The server granted without a paid unit; it cannot be resized or deleted.
            seats_cap:
              type: integer
              minimum: 0
              description: Mailboxes the server can hold.
            seats_used:
              type: integer
              minimum: 0
              description: Mailboxes it holds now.
            ipv4:
              type: string
              nullable: true
            release:
              type: string
              nullable: true
              description: The gtm.service.email release the server runs.
            run:
              type: object
              nullable: true
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
              description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
            price:
              type: object
              nullable: true
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
            renews_at:
              type: string
              nullable: true
              description: The subscription's next billing date.
            paid_through:
              type: string
              nullable: true
              description: "Set by a delete: the end of the period the server was paid for."
            failed_error_code:
              type: string
              nullable: true
            created_at:
              type: string
              nullable: true
            provisioned_at:
              type: string
              nullable: true
            suspended_at:
              type: string
              nullable: true
            updated_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - plan
            - location
            - status
            - suspended_reason
            - complimentary
            - seats_cap
            - seats_used
            - ipv4
            - release
            - run
            - price
            - renews_at
            - paid_through
            - failed_error_code
            - created_at
            - provisioned_at
            - suspended_at
            - updated_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    ReturnAccountShareRequest:
      type: object
      description: Request body of `return_account_share`.
      properties:
        sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^ac_sh_
          description: Single-share mode. Mutually exclusive with filter.
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - linkedin
                    - email
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - linkedin
                      - email
              additionalProperties: false
              description: '"My LinkedIn loans" vs "my email loans".'
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                ne:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
              additionalProperties: false
              description: 'The phase. { eq: "active" } is the live set; { in: ["rolling_back","failed"] } is the loans that gave up.'
            to_team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Owner side question: everything lent to team X."
            to_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'Share history of an owned account: "is this account lent out, and to whom".'
            holder_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Holder side question: map a borrowed copy back to its loan."
            holder_over_slot:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
              description: Which loans reached active but landed with no free slot on the holder side.
            end_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - returned_by_holder
                    - recalled_by_owner
                    - holder_deleted_copy
                    - holder_team_purged
                    - owner_team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            failure_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - park_failed
                    - export_failed
                    - copy_refused
                    - probe_stale
                    - team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            owner_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            holder_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            phase_claimed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            planned_return_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "{ is_null: true } is an open ended lend."
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
          description: Mass-target mode, resolved against the loans you RECEIVED. status is overwritten with eq active server side. Mutually exclusive with sid.
        confirmation_count:
          type: integer
          minimum: 0
          description: Blast-radius confirmation, REQUIRED with filter and ignored with sid. Must equal the active-pinned pagination.total_count of the same filter from list_received_account_shares.
    ReturnAccountShareResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
              description: "The OWNER team: the row tenant, the side that lent the account out."
            channel:
              type: string
              enum:
                - linkedin
                - email
              description: Which channel service owns the physical account pair.
            to_team_sid:
              type: string
              description: "The HOLDER team: the side that borrowed the account."
            to_user_sid:
              type: string
              nullable: true
              description: Resolved user when the share was targeted by email; null when targeted by team sid.
            to_email:
              type: string
              nullable: true
              description: The targeting input kept for audit; null when targeted by team sid.
            owner_cluster_id:
              type: integer
            holder_cluster_id:
              type: integer
            owner_account_sid:
              type: string
              description: "The owner's channel account row, parked for the duration of the loan. Prefix agnostic: ln_ac_ on LinkedIn, em_ac_ on email."
            owner_channel_ref:
              type: string
              nullable: true
              description: Opaque second row the channel needs to name (LinkedIn puts its ab_br_ browser sid here); null when the channel needs none.
            holder_account_sid:
              type: string
              nullable: true
              description: The holder's copy. NULL until the copy phase lands, so it is null on every pre-active row.
            holder_channel_ref:
              type: string
              nullable: true
            owner_account_label:
              type: string
              nullable: true
              description: "The channel's display name for the lent account, e.g. \"Jane Roe (jane-roe)\". Use it to tell one share from another when reporting to a human. Null when the channel had no name to give. Display only: never filter, match or reason on it."
            status:
              type: string
              enum:
                - pending
                - owner_parked
                - active
                - closing
                - holder_released
                - rolling_back
                - returned
                - recalled
                - failed
              description: The durable phase, and the answer to "did the loan start". Only active means the holder can work.
            holder_over_slot:
              type: boolean
              description: True when the holder had no free account slot at create, so the copy landed in the channel's subscription hold. The loan still reaches active; the holder cannot work until it upgrades.
            end_reason:
              type: string
              nullable: true
              enum:
                - returned_by_holder
                - recalled_by_owner
                - holder_deleted_copy
                - holder_team_purged
                - owner_team_purged
              description: Stamped when an ending is REQUESTED. Only ever set on a row that reached active.
            failure_reason:
              type: string
              nullable: true
              enum:
                - park_failed
                - export_failed
                - copy_refused
                - probe_stale
                - team_purged
              description: Why a pre-active phase gave up. Non null on exactly rolling_back and failed.
            planned_return_at:
              type: string
              nullable: true
              description: Informational only. When it passes the owner is emailed a recall link once; there is NO auto return.
            expiry_notified_at:
              type: string
              nullable: true
            phase_claimed_at:
              type: string
              nullable: true
            phase_attempts:
              type: integer
              description: Attempts on the CURRENT phase, reset on every advance. A large and growing value is the stuck signal on a phase that may not give up.
            ended_at:
              type: string
              nullable: true
            ended_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
              description: Who ended it. The machine readable why is end_reason (an ending) or failure_reason (a failure), never this blob.
            created_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - team_sid
            - channel
            - to_team_sid
            - to_user_sid
            - to_email
            - owner_cluster_id
            - holder_cluster_id
            - owner_account_sid
            - owner_channel_ref
            - holder_account_sid
            - holder_channel_ref
            - owner_account_label
            - status
            - holder_over_slot
            - end_reason
            - failure_reason
            - planned_return_at
            - expiry_notified_at
            - phase_claimed_at
            - phase_attempts
            - ended_at
            - ended_by
            - created_by
            - created_at
            - updated_at
        result:
          type: object
          properties:
            closing_count:
              type: integer
              minimum: 0
              description: Shares this call stamped closing. The teardown is the driver's, so this is never "recalled" or "returned".
            total_matched:
              type: integer
              minimum: 0
              description: True count of active shares the target set held. closing_count below this means a remainder is left; re-read the count before the next call.
          required:
            - closing_count
            - total_matched
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RevokeOauthAuthorizationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            user_sid:
              type: string
            oauth_client_sid:
              type: string
            team_scope_mode:
              type: string
              enum:
                - selected
                - all_my_teams
            consented_team_sids:
              type: array
              items:
                type: string
            permissions:
              type: array
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
            last_used_at:
              type: string
              nullable: true
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - user_sid
            - oauth_client_sid
            - team_scope_mode
            - consented_team_sids
            - permissions
            - status
            - last_used_at
            - created_at
            - updated_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RevokeSessionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
            status:
              type: string
              enum:
                - active
                - revoked
                - expired
            kind:
              type: string
              enum:
                - login
                - oauth
            oauth_client_sid:
              type: string
              nullable: true
            oauth_authorization_sid:
              type: string
              nullable: true
            device:
              type: string
              nullable: true
            ip_hash:
              type: string
              nullable: true
            last_active_at:
              type: string
            expires_at:
              type: string
            created_at:
              type: string
            updated_at:
              type: string
            is_current:
              type: boolean
          required:
            - sid
            - team_sid
            - user_sid
            - status
            - kind
            - oauth_client_sid
            - oauth_authorization_sid
            - device
            - ip_hash
            - last_active_at
            - expires_at
            - created_at
            - updated_at
            - is_current
        result:
          type: object
          properties:
            already_revoked:
              type: boolean
            revoked_at:
              type: string
              nullable: true
          required:
            - already_revoked
            - revoked_at
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    RotateApiKeyRequest:
      type: object
      description: Request body of `rotate_api_key`.
      properties:
        grace_seconds:
          type: integer
          minimum: 0
          maximum: 604800
          description: 0..604800 (≤7d); omit = 24h default; 0 = immediate cutover.
    RotateApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
            token_prefix:
              type: string
            token_last4:
              type: string
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
                - expired
            expires_at:
              type: string
              nullable: true
            last_used_at:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            plaintext_token:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - token_prefix
            - token_last4
            - permissions
            - account_sids
            - status
            - expires_at
            - last_used_at
            - created_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    SearchAccountSharesRequest:
      type: object
      description: Request body of `search_account_shares`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - linkedin
                    - email
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - linkedin
                      - email
              additionalProperties: false
              description: '"My LinkedIn loans" vs "my email loans".'
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                ne:
                  type: string
                  enum:
                    - pending
                    - owner_parked
                    - active
                    - closing
                    - holder_released
                    - rolling_back
                    - returned
                    - recalled
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
              additionalProperties: false
              description: 'The phase. { eq: "active" } is the live set; { in: ["rolling_back","failed"] } is the loans that gave up.'
            to_team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Owner side question: everything lent to team X."
            to_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'Share history of an owned account: "is this account lent out, and to whom".'
            holder_account_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Holder side question: map a borrowed copy back to its loan."
            holder_over_slot:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
              description: Which loans reached active but landed with no free slot on the holder side.
            end_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - returned_by_holder
                    - recalled_by_owner
                    - holder_deleted_copy
                    - holder_team_purged
                    - owner_team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            failure_reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - park_failed
                    - export_failed
                    - copy_refused
                    - probe_stale
                    - team_purged
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                is_null:
                  type: boolean
              additionalProperties: false
            owner_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            holder_cluster_id:
              type: object
              properties:
                eq:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
              additionalProperties: false
            phase_claimed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            planned_return_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "{ is_null: true } is an open ended lend."
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
        include:
          type: array
          items:
            type: string
            enum:
              - counterparty_team
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - planned_return_at
                - updated_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 200
          description: 0..200, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchAccountSharesResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                    description: "The OWNER team: the row tenant, the side that lent the account out."
                  channel:
                    type: string
                    enum:
                      - linkedin
                      - email
                    description: Which channel service owns the physical account pair.
                  to_team_sid:
                    type: string
                    description: "The HOLDER team: the side that borrowed the account."
                  to_user_sid:
                    type: string
                    nullable: true
                    description: Resolved user when the share was targeted by email; null when targeted by team sid.
                  to_email:
                    type: string
                    nullable: true
                    description: The targeting input kept for audit; null when targeted by team sid.
                  owner_cluster_id:
                    type: integer
                  holder_cluster_id:
                    type: integer
                  owner_account_sid:
                    type: string
                    description: "The owner's channel account row, parked for the duration of the loan. Prefix agnostic: ln_ac_ on LinkedIn, em_ac_ on email."
                  owner_channel_ref:
                    type: string
                    nullable: true
                    description: Opaque second row the channel needs to name (LinkedIn puts its ab_br_ browser sid here); null when the channel needs none.
                  holder_account_sid:
                    type: string
                    nullable: true
                    description: The holder's copy. NULL until the copy phase lands, so it is null on every pre-active row.
                  holder_channel_ref:
                    type: string
                    nullable: true
                  owner_account_label:
                    type: string
                    nullable: true
                    description: "The channel's display name for the lent account, e.g. \"Jane Roe (jane-roe)\". Use it to tell one share from another when reporting to a human. Null when the channel had no name to give. Display only: never filter, match or reason on it."
                  status:
                    type: string
                    enum:
                      - pending
                      - owner_parked
                      - active
                      - closing
                      - holder_released
                      - rolling_back
                      - returned
                      - recalled
                      - failed
                    description: The durable phase, and the answer to "did the loan start". Only active means the holder can work.
                  holder_over_slot:
                    type: boolean
                    description: True when the holder had no free account slot at create, so the copy landed in the channel's subscription hold. The loan still reaches active; the holder cannot work until it upgrades.
                  end_reason:
                    type: string
                    nullable: true
                    enum:
                      - returned_by_holder
                      - recalled_by_owner
                      - holder_deleted_copy
                      - holder_team_purged
                      - owner_team_purged
                    description: Stamped when an ending is REQUESTED. Only ever set on a row that reached active.
                  failure_reason:
                    type: string
                    nullable: true
                    enum:
                      - park_failed
                      - export_failed
                      - copy_refused
                      - probe_stale
                      - team_purged
                    description: Why a pre-active phase gave up. Non null on exactly rolling_back and failed.
                  planned_return_at:
                    type: string
                    nullable: true
                    description: Informational only. When it passes the owner is emailed a recall link once; there is NO auto return.
                  expiry_notified_at:
                    type: string
                    nullable: true
                  phase_claimed_at:
                    type: string
                    nullable: true
                  phase_attempts:
                    type: integer
                    description: Attempts on the CURRENT phase, reset on every advance. A large and growing value is the stuck signal on a phase that may not give up.
                  ended_at:
                    type: string
                    nullable: true
                  ended_by:
                    type: object
                    nullable: true
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                    description: Who ended it. The machine readable why is end_reason (an ending) or failure_reason (a failure), never this blob.
                  created_by:
                    type: object
                    nullable: true
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - sid
                  - team_sid
                  - channel
                  - to_team_sid
                  - to_user_sid
                  - to_email
                  - owner_cluster_id
                  - holder_cluster_id
                  - owner_account_sid
                  - owner_channel_ref
                  - holder_account_sid
                  - holder_channel_ref
                  - owner_account_label
                  - status
                  - holder_over_slot
                  - end_reason
                  - failure_reason
                  - planned_return_at
                  - expiry_notified_at
                  - phase_claimed_at
                  - phase_attempts
                  - ended_at
                  - ended_by
                  - created_by
                  - created_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          additionalProperties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchApiKeysRequest:
      type: object
      description: Request body of `search_api_keys`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                ne:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
              additionalProperties: false
            name:
              type: object
              properties:
                eq:
                  type: string
              additionalProperties: false
              description: Match on the human-readable key name.
            created_by_actor_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Issuer slice: keys created by this teammate (us_mb_) or parent key (id_ak_); offboarding."
            expires_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = perpetual keys; range = expiring-between.
            last_used_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = never used; lt = stale keys.
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
        include:
          type: array
          items:
            type: string
            enum:
              - metrics
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - last_used_at
                - expires_at
                - name
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchApiKeysResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  name:
                    type: string
                  token_prefix:
                    type: string
                  token_last4:
                    type: string
                  permissions:
                    type: array
                    items:
                      type: string
                  account_sids:
                    type: array
                    nullable: true
                    items:
                      type: string
                  status:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
                  expires_at:
                    type: string
                    nullable: true
                  last_used_at:
                    type: string
                    nullable: true
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                  plaintext_token:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - name
                  - token_prefix
                  - token_last4
                  - permissions
                  - account_sids
                  - status
                  - expires_at
                  - last_used_at
                  - created_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchApiRequestsRequest:
      type: object
      description: Request body of `search_api_requests`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            service:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - id
                    - linkedin
                    - orchestration
                ne:
                  type: string
                  enum:
                    - id
                    - linkedin
                    - orchestration
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - id
                      - linkedin
                      - orchestration
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - id
                      - linkedin
                      - orchestration
              additionalProperties: false
              description: "Which answering service: id (keys, teams, billing), linkedin (the channel), orchestration (mass actions, webhooks). Excluded services are not asked."
            surface:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - api_key
                    - agent
                    - oauth_other
                ne:
                  type: string
                  enum:
                    - api_key
                    - agent
                    - oauth_other
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - agent
                      - oauth_other
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - agent
                      - oauth_other
              additionalProperties: false
              description: api_key = bearer keys (scripts, n8n); agent = OAuth clients of kind agent (Claude, Cursor); oauth_other = other OAuth clients.
            credential_kind:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - api_key
                    - oauth
                ne:
                  type: string
                  enum:
                    - api_key
                    - oauth
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - oauth
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - api_key
                      - oauth
              additionalProperties: false
            client_sid:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "The credential: an api key sid (id_ak_*) or an OAuth client sid (id_oc_*). \"What did Claude do\" = that client's sid."
            actor_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The member an OAuth client delegates for (us_mb_*); is_null:true = api-key traffic.
            entity:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "The entity the route names, snake singular: linkedin_conversation, linkedin_message, mass_action, api_key."
            operation:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - get
                    - search
                    - metrics
                    - group_by
                    - create
                    - update
                    - delete
                    - action
                ne:
                  type: string
                  enum:
                    - get
                    - search
                    - metrics
                    - group_by
                    - create
                    - update
                    - delete
                    - action
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - get
                      - search
                      - metrics
                      - group_by
                      - create
                      - update
                      - delete
                      - action
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - get
                      - search
                      - metrics
                      - group_by
                      - create
                      - update
                      - delete
                      - action
              additionalProperties: false
            action_name:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The verb of an action route (send, run_now); is_null:true = the six canonical operations.
            route:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'The route key, exact: "POST api/linkedin-conversations/search".'
            account_sid:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: 'The account the request named (ln_ac_*, em_ac_*): "everything that was refused on this sender". is_null:true = calls that named no account.'
            status:
              type: object
              properties:
                eq:
                  type: integer
                ne:
                  type: integer
                in:
                  type: array
                  items:
                    type: integer
                nin:
                  type: array
                  items:
                    type: integer
                gte:
                  type: integer
                lte:
                  type: integer
                gt:
                  type: integer
                lt:
                  type: integer
              additionalProperties: false
            status_family:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - 2xx
                    - 3xx
                    - 4xx
                    - 5xx
                ne:
                  type: string
                  enum:
                    - 2xx
                    - 3xx
                    - 4xx
                    - 5xx
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - 2xx
                      - 3xx
                      - 4xx
                      - 5xx
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - 2xx
                      - 3xx
                      - 4xx
                      - 5xx
              additionalProperties: false
              description: 4xx and 5xx together are the errors every dashboard number counts.
            error_code:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The typed error code of the envelope that was returned (rate_limited, validation_failed, not_found); is_null:true = the calls that succeeded.
            error_reason:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "The sub-code inside error.context (bucket_saturated, account_rate_exceeded, not_connected): what a status alone cannot say."
            error_cause:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "The specific trigger a layered gate adds (held, daily_saturation, delay_not_elapsed, linkedin_quota_hit): held means a person paused the account, daily_saturation means the limit is spent, and a 429 does not tell them apart."
            occurred_at:
              type: object
              properties:
                eq:
                  type: string
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
              description: ISO 8601 UTC. The only time axis on search; ignored on metrics, where period is the window.
            trace_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: All the calls of one MCP turn share a trace id.
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - occurred_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 200
          description: 0..200, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchApiRequestsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  service:
                    type: string
                    enum:
                      - id
                      - linkedin
                      - orchestration
                  occurred_at:
                    type: string
                  surface:
                    type: string
                    enum:
                      - api_key
                      - agent
                      - oauth_other
                  credential_kind:
                    type: string
                    enum:
                      - api_key
                      - oauth
                  client_sid:
                    type: string
                  client_name:
                    type: string
                    nullable: true
                  actor_sid:
                    type: string
                    nullable: true
                  method:
                    type: string
                  route:
                    type: string
                  entity:
                    type: string
                  operation:
                    type: string
                    enum:
                      - get
                      - search
                      - metrics
                      - group_by
                      - create
                      - update
                      - delete
                      - action
                  action_name:
                    type: string
                    nullable: true
                  account_sid:
                    type: string
                    nullable: true
                  status:
                    type: integer
                  status_family:
                    type: string
                    enum:
                      - 2xx
                      - 3xx
                      - 4xx
                      - 5xx
                  error_code:
                    type: string
                    nullable: true
                  error_reason:
                    type: string
                    nullable: true
                  error_cause:
                    type: string
                    nullable: true
                  duration_ms:
                    type: integer
                    nullable: true
                  trace_id:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - service
                  - occurred_at
                  - surface
                  - credential_kind
                  - client_sid
                  - client_name
                  - actor_sid
                  - method
                  - route
                  - entity
                  - operation
                  - action_name
                  - account_sid
                  - status
                  - status_family
                  - error_code
                  - error_reason
                  - error_cause
                  - duration_ms
                  - trace_id
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: integer
            sources:
              type: object
              additionalProperties:
                type: string
                enum:
                  - ok
                  - error
                  - unconfigured
              description: "Which services this answer counts: ok / error (did not answer, contributes nothing) / unconfigured. A service the `service` filter excludes is absent."
          required:
            - total_count
            - sources
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchBillingProductsRequest:
      type: object
      description: Request body of `search_billing_products`.
      properties:
        filter:
          type: object
          properties:
            q:
              type: string
              description: Full-text (LIKE) over name / slug.
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            paddle_product_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            slug:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            type:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - plan
                    - addon
                    - credits_pack
                ne:
                  type: string
                  enum:
                    - plan
                    - addon
                    - credits_pack
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - plan
                      - addon
                      - credits_pack
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - plan
                      - addon
                      - credits_pack
              additionalProperties: false
            is_active:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            updated_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
        include:
          type: array
          items:
            type: string
            enum:
              - prices
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - updated_at
                - created_at
                - slug
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchBillingProductsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  paddle_product_id:
                    type: string
                    nullable: true
                  name:
                    type: string
                  slug:
                    type: string
                  type:
                    type: string
                    enum:
                      - plan
                      - addon
                      - credits_pack
                  limits:
                    type: object
                    properties:
                      accounts:
                        type: number
                      cloud_browser:
                        type: number
                      webhooks:
                        type: number
                    required:
                      - accounts
                      - cloud_browser
                      - webhooks
                  is_active:
                    type: boolean
                  visibility:
                    type: string
                    nullable: true
                    enum:
                      - public
                      - private
                    description: Whether the product is listed in the public catalog. This search lists public products only, so it reads public here; a private product never appears in it.
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - paddle_product_id
                  - name
                  - slug
                  - type
                  - limits
                  - is_active
                  - visibility
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              properties:
                type:
                  type: object
                  additionalProperties:
                    type: number
                is_active:
                  type: object
                  properties:
                    "true":
                      type: number
                    "false":
                      type: number
                  required:
                    - "true"
                    - "false"
              required:
                - type
                - is_active
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchBillingSubscriptionsRequest:
      type: object
      description: Request body of `search_billing_subscriptions`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            paddle_subscription_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - past_due
                    - paused
                    - canceled
                ne:
                  type: string
                  enum:
                    - active
                    - past_due
                    - paused
                    - canceled
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - past_due
                      - paused
                      - canceled
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - past_due
                      - paused
                      - canceled
              additionalProperties: false
            collection_mode:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - automatic
                    - manual
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - automatic
                      - manual
              additionalProperties: false
            price_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            current_period_ends_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            next_billed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            canceled_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            updated_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
        include:
          type: array
          items:
            type: string
            enum:
              - price
              - product
              - team
              - latest_transactions
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - updated_at
                - current_period_ends_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchBillingSubscriptionsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  owner_user_sid:
                    type: string
                  team_sid:
                    type: string
                    nullable: true
                  paddle_subscription_id:
                    type: string
                    nullable: true
                  status:
                    type: string
                    enum:
                      - active
                      - past_due
                      - paused
                      - canceled
                  collection_mode:
                    type: string
                    enum:
                      - automatic
                      - manual
                  price_sid:
                    type: string
                  quantity:
                    type: number
                  addons:
                    type: array
                    items:
                      type: object
                      properties:
                        product_sid:
                          type: string
                        price_sid:
                          type: string
                        paddle_item_id:
                          type: string
                          nullable: true
                        quantity:
                          type: number
                        status:
                          type: string
                          enum:
                            - active
                            - canceled
                      required:
                        - product_sid
                        - price_sid
                        - paddle_item_id
                        - quantity
                        - status
                  currency:
                    type: string
                  current_period_starts_at:
                    type: string
                    nullable: true
                  current_period_ends_at:
                    type: string
                    nullable: true
                  next_billed_at:
                    type: string
                    nullable: true
                  paused_at:
                    type: string
                    nullable: true
                  scheduled_resume_at:
                    type: string
                    nullable: true
                  scheduled_change:
                    type: object
                    nullable: true
                    properties:
                      action:
                        type: string
                        enum:
                          - cancel
                          - pause
                          - resume
                      effective_at:
                        type: string
                      resume_at:
                        type: string
                        nullable: true
                    required:
                      - action
                      - effective_at
                      - resume_at
                  canceled_at:
                    type: string
                    nullable: true
                  canceled_by:
                    type: object
                    nullable: true
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                      team_sid:
                        type: string
                      permissions:
                        type: object
                        additionalProperties: {}
                      request_sid:
                        type: string
                        nullable: true
                      reason:
                        type: string
                        nullable: true
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                      - reason
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - owner_user_sid
                  - team_sid
                  - paddle_subscription_id
                  - status
                  - collection_mode
                  - price_sid
                  - quantity
                  - addons
                  - currency
                  - current_period_starts_at
                  - current_period_ends_at
                  - next_billed_at
                  - paused_at
                  - scheduled_resume_at
                  - scheduled_change
                  - canceled_at
                  - canceled_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchBillingTransactionsRequest:
      type: object
      description: Request body of `search_billing_transactions`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            subscription_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            paddle_transaction_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            invoice_number:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - billed
                    - paid
                    - completed
                    - past_due
                    - canceled
                ne:
                  type: string
                  enum:
                    - billed
                    - paid
                    - completed
                    - past_due
                    - canceled
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - billed
                      - paid
                      - completed
                      - past_due
                      - canceled
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - billed
                      - paid
                      - completed
                      - past_due
                      - canceled
              additionalProperties: false
            origin:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - subscription_charge
                    - subscription_update
                    - one_time
                ne:
                  type: string
                  enum:
                    - subscription_charge
                    - subscription_update
                    - one_time
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - subscription_charge
                      - subscription_update
                      - one_time
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - subscription_charge
                      - subscription_update
                      - one_time
              additionalProperties: false
            collection_mode:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - automatic
                    - manual
                ne:
                  type: string
                  enum:
                    - automatic
                    - manual
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - automatic
                      - manual
              additionalProperties: false
            currency:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            billed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
        include:
          type: array
          items:
            type: string
            enum:
              - subscription
              - owner
              - team
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - billed_at
                - created_at
                - total
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchBillingTransactionsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  owner_user_sid:
                    type: string
                  team_sid:
                    type: string
                    nullable: true
                  subscription_sid:
                    type: string
                    nullable: true
                  paddle_transaction_id:
                    type: string
                  status:
                    type: string
                    enum:
                      - billed
                      - paid
                      - completed
                      - past_due
                      - canceled
                  origin:
                    type: string
                    enum:
                      - subscription_charge
                      - subscription_update
                      - one_time
                  collection_mode:
                    type: string
                    enum:
                      - automatic
                      - manual
                  invoice_number:
                    type: string
                    nullable: true
                  total:
                    type: string
                  tax:
                    type: string
                    nullable: true
                  currency:
                    type: string
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        price_sid:
                          type: string
                          nullable: true
                        product_sid:
                          type: string
                          nullable: true
                        product_type:
                          type: string
                          enum:
                            - plan
                            - addon
                            - credits_pack
                        quantity:
                          type: number
                        unit_amount:
                          type: string
                        paddle_price_id:
                          type: string
                          nullable: true
                      required:
                        - price_sid
                        - product_sid
                        - product_type
                        - quantity
                        - unit_amount
                        - paddle_price_id
                  billed_at:
                    type: string
                    nullable: true
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - sid
                  - owner_user_sid
                  - team_sid
                  - subscription_sid
                  - paddle_transaction_id
                  - status
                  - origin
                  - collection_mode
                  - invoice_number
                  - total
                  - tax
                  - currency
                  - items
                  - billed_at
                  - created_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchEmailAccountDirectoryRequest:
      type: object
      description: Request body of `search_email_account_directory`.
      properties:
        filter:
          type: object
          properties:
            q:
              type: string
              minLength: 2
              maxLength: 100
              description: A part of the address, the display name or the label, 2 to 100 characters.
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            email_box_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: One server's mailboxes.
            provider:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            subscription_hold_reason:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            address:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: The whole address; a part of it goes in q.
            address_domain:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            label:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
            sending_paused_reason:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "is_null false: every mailbox whose sending is paused."
            connected_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            status_changed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
              additionalProperties: false
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - address
                - label
                - status_changed_at
                - connected_at
                - created_at
            direction:
              type: string
              enum:
                - asc
                - desc
          required:
            - field
          description: Default address, ascending. No label and no connected_at come first ascending, last descending.
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. 0 = counts only.
        cursor:
          type: string
          description: pagination.next_cursor of the previous page.
    SearchEmailAccountDirectoryResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                    description: The mailbox's own sid (em_ac_...), the one its server uses.
                  team_sid:
                    type: string
                  email_box_sid:
                    type: string
                    nullable: true
                    description: "The email server that holds the mailbox (em_bx_...): the server to address any call about it. Null for a mailbox of the shared deployment that no server owns."
                  provider:
                    type: string
                    description: google, microsoft, imap_smtp or gtm_hosted.
                  address:
                    type: string
                    description: Lowercase.
                  address_domain:
                    type: string
                    description: The part of the address after the @.
                  display_name:
                    type: string
                    nullable: true
                  label:
                    type: string
                    nullable: true
                    description: The customer's own tag on the mailbox.
                  status:
                    type: string
                    description: connecting, active, reconnect_required, disconnected or subscription_required, as the server last reported it.
                  reconnect_reason:
                    type: string
                    nullable: true
                    description: Why the mailbox needs reconnecting, while status is reconnect_required.
                  subscription_hold_reason:
                    type: string
                    nullable: true
                    description: server_full or server_suspended, while status is subscription_required.
                  sending_paused_reason:
                    type: string
                    nullable: true
                    description: "manual, bounce_rate, complaint_rate, provider_block, warmup_guard or provider_quota. Null: sending is not paused, though a status other than active still keeps the mailbox from sending."
                  connected_at:
                    type: string
                    nullable: true
                  status_changed_at:
                    type: string
                    description: When the current status was first reported.
                  observed_at:
                    type: string
                    description: "The server's clock at the read this copy is from: how fresh the row is."
                  created_at:
                    type: string
                    nullable: true
                    description: The mailbox's own creation time.
                  updated_at:
                    type: string
                    nullable: true
                    description: The last change of this copy.
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - email_box_sid
                  - provider
                  - address
                  - address_domain
                  - display_name
                  - label
                  - status
                  - reconnect_reason
                  - subscription_hold_reason
                  - sending_paused_reason
                  - connected_at
                  - status_changed_at
                  - observed_at
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: integer
              minimum: 0
            groups:
              type: object
              additionalProperties: {}
              description: Per axis (email_box_sid, status, provider, subscription_hold_reason, sending_paused_reason) a map value to count, over the whole filter. A null value is in no group.
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchEmailBoxesRequest:
      type: object
      description: Request body of `search_email_boxes`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - provisioning
                    - active
                    - suspended
                    - resizing
                    - destroying
                    - destroyed
                    - failed
                ne:
                  type: string
                  enum:
                    - provisioning
                    - active
                    - suspended
                    - resizing
                    - destroying
                    - destroyed
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - provisioning
                      - active
                      - suspended
                      - resizing
                      - destroying
                      - destroyed
                      - failed
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - provisioning
                      - active
                      - suspended
                      - resizing
                      - destroying
                      - destroyed
                      - failed
              additionalProperties: false
              description: Without it the search answers the servers that still exist; name destroyed to see destroyed ones.
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. 0 = count only (pagination.total_count).
    SearchEmailBoxesResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  name:
                    type: string
                    description: The label the customer chose; "Server N" when nobody did.
                  plan:
                    type: string
                    enum:
                      - starter
                      - growth
                      - agency
                      - dedicated
                    description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
                  location:
                    type: string
                    nullable: true
                    enum:
                      - hel1
                      - fsn1
                      - nbg1
                    description: Null on a server older than the choice.
                  status:
                    type: string
                    enum:
                      - provisioning
                      - active
                      - suspended
                      - resizing
                      - destroying
                      - destroyed
                      - failed
                    description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
                  suspended_reason:
                    type: string
                    nullable: true
                    enum:
                      - payment_failed
                      - unpaid
                    description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
                  destroy_at:
                    type: string
                    nullable: true
                    description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
                  complimentary:
                    type: boolean
                    description: The server granted without a paid unit; it cannot be resized or deleted.
                  seats_cap:
                    type: integer
                    minimum: 0
                    description: Mailboxes the server can hold.
                  seats_used:
                    type: integer
                    minimum: 0
                    description: Mailboxes it holds now.
                  ipv4:
                    type: string
                    nullable: true
                  release:
                    type: string
                    nullable: true
                    description: The gtm.service.email release the server runs.
                  run:
                    type: object
                    nullable: true
                    properties:
                      verb:
                        type: string
                        description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                      status:
                        type: string
                        description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                      phase:
                        type: string
                        nullable: true
                      phase_index:
                        type: integer
                        minimum: 0
                        description: 1-based among phase_count; 0 before the first phase started.
                      phase_count:
                        type: integer
                        minimum: 0
                      started_at:
                        type: string
                        nullable: true
                      error_code:
                        type: string
                        nullable: true
                    required:
                      - verb
                      - status
                      - phase
                      - phase_index
                      - phase_count
                      - started_at
                      - error_code
                    description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
                  price:
                    type: object
                    nullable: true
                    properties:
                      amount:
                        type: string
                        description: Decimal string, e.g. "49.00".
                      currency:
                        type: string
                        description: ISO 4217.
                      interval:
                        type: string
                        description: month or year.
                    required:
                      - amount
                      - currency
                      - interval
                    description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
                  renews_at:
                    type: string
                    nullable: true
                    description: The subscription's next billing date.
                  paid_through:
                    type: string
                    nullable: true
                    description: "Set by a delete: the end of the period the server was paid for."
                  failed_error_code:
                    type: string
                    nullable: true
                  created_at:
                    type: string
                    nullable: true
                  provisioned_at:
                    type: string
                    nullable: true
                  suspended_at:
                    type: string
                    nullable: true
                  updated_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - name
                  - plan
                  - location
                  - status
                  - suspended_reason
                  - complimentary
                  - seats_cap
                  - seats_used
                  - ipv4
                  - release
                  - run
                  - price
                  - renews_at
                  - paid_through
                  - failed_error_code
                  - created_at
                  - provisioned_at
                  - suspended_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          additionalProperties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchNotificationsRequest:
      type: object
      description: Request body of `search_notifications`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Scoped by JWT; explicit override only for internal-support.
            user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: "Recipient: \"show me Joe's notifications\"."
            event_name:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: e.g. linkedin-accounts.logged-out.
            read_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = unread.
            entity_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The domain entity a notification is about (e.g. a linkedin_account sid).
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - delivered
                    - failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - delivered
                      - failed
              additionalProperties: false
            channel:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - email
                    - in_app
              additionalProperties: false
            scheduled_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            delivered_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = not yet delivered.
            failed_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (undismissed rows)."
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - scheduled_at
                - delivered_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchNotificationsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  user_sid:
                    type: string
                    nullable: true
                  event_name:
                    type: string
                  event_sid:
                    type: string
                  entity_sid:
                    type: string
                    nullable: true
                  channel:
                    type: string
                    enum:
                      - email
                      - in_app
                  status:
                    type: string
                    enum:
                      - pending
                      - delivered
                      - failed
                  subject:
                    type: string
                  body_html:
                    type: string
                  body_text:
                    type: string
                  rate_limit_bucket:
                    type: string
                  scheduled_at:
                    type: string
                  delivered_at:
                    type: string
                    nullable: true
                  failed_at:
                    type: string
                    nullable: true
                  failure_reason:
                    type: string
                    nullable: true
                  read_at:
                    type: string
                    nullable: true
                    description: "ISO 8601 UTC: when the recipient read an in-app notification. Every notification this platform writes is an email, so it is null here and no verb marks one read."
                  retry_count:
                    type: number
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                      team_sid:
                        type: string
                      permissions:
                        type: object
                        additionalProperties: {}
                      request_sid:
                        type: string
                        nullable: true
                      reason:
                        type: string
                        nullable: true
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                      - reason
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - user_sid
                  - event_name
                  - event_sid
                  - entity_sid
                  - channel
                  - status
                  - subject
                  - rate_limit_bucket
                  - scheduled_at
                  - delivered_at
                  - failed_at
                  - failure_reason
                  - read_at
                  - retry_count
                  - created_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchOauthAuthorizationsRequest:
      type: object
      description: Request body of `search_oauth_authorizations`.
      properties:
        filter:
          type: object
          properties:
            oauth_client_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Filter to one connected client.
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - revoked
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
              additionalProperties: false
              description: active vs revoked (history).
            team_scope_mode:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - selected
                    - all_my_teams
              additionalProperties: false
              description: Which grants are all_my_teams vs selected.
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
              additionalProperties: false
              description: Connected-since window.
            last_used_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = never used; range = recently active.
        include:
          type: array
          items:
            type: string
            enum:
              - client
              - teams
              - active_sessions
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - last_used_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchOauthAuthorizationsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  user_sid:
                    type: string
                  oauth_client_sid:
                    type: string
                  team_scope_mode:
                    type: string
                    enum:
                      - selected
                      - all_my_teams
                  consented_team_sids:
                    type: array
                    items:
                      type: string
                  permissions:
                    type: array
                    items:
                      type: string
                  status:
                    type: string
                    enum:
                      - active
                      - revoked
                  last_used_at:
                    type: string
                    nullable: true
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - sid
                  - user_sid
                  - oauth_client_sid
                  - team_scope_mode
                  - consented_team_sids
                  - permissions
                  - status
                  - last_used_at
                  - created_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchOauthClientsRequest:
      type: object
      description: Request body of `search_oauth_clients`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = platform clients (owned by no team).
            client_id:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Exact public identifier lookup.
            name:
              type: object
              properties:
                eq:
                  type: string
              additionalProperties: false
              description: Match on the human-readable client name.
            actor_kind:
              type: object
              properties:
                eq:
                  type: string
                ne:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                nin:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: What the client is (agent, integration, ...); is_null:true = unclassified legacy clients.
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - disabled
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - disabled
              additionalProperties: false
            is_confidential:
              type: object
              properties:
                eq:
                  type: boolean
              additionalProperties: false
              description: public/PKCE (false) vs confidential (true).
            registration_kind:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - manual
                    - dynamic
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - manual
                      - dynamic
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
        include:
          type: array
          items:
            type: string
            enum:
              - active_sessions
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - name
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchOauthClientsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                    nullable: true
                  name:
                    type: string
                  client_id:
                    type: string
                  redirect_uris:
                    type: array
                    items:
                      type: string
                  grant_types:
                    type: array
                    items:
                      type: string
                      enum:
                        - authorization_code
                        - refresh_token
                  permissions:
                    type: array
                    items:
                      type: string
                  is_confidential:
                    type: boolean
                  registration_kind:
                    type: string
                    enum:
                      - manual
                      - dynamic
                  actor_kind:
                    type: string
                    nullable: true
                    enum:
                      - agent
                      - integration
                    description: "What acts through the client: agent (an AI agent that registered itself or was registered as one) or integration (an app a person set up). Null = unclassified, a client from before the field (2026-08-02), never backfilled."
                  status:
                    type: string
                    enum:
                      - active
                      - disabled
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                  client_secret:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - name
                  - client_id
                  - redirect_uris
                  - grant_types
                  - permissions
                  - is_confidential
                  - registration_kind
                  - actor_kind
                  - status
                  - created_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchSessionsRequest:
      type: object
      description: Request body of `search_sessions`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Own sessions by default; other users require admin (sessions.view).
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                ne:
                  type: string
                  enum:
                    - active
                    - revoked
                    - expired
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
              additionalProperties: false
              description: 'Default scope = { eq: "active" }; pass explicitly for revoked/expired history.'
            kind:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - login
                    - oauth
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - login
                      - oauth
              additionalProperties: false
              description: kind:{eq:"oauth"} = "Connected agents".
            oauth_client_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = login sessions only.
            last_active_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            expires_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - last_active_at
                - created_at
                - expires_at
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchSessionsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  user_sid:
                    type: string
                  status:
                    type: string
                    enum:
                      - active
                      - revoked
                      - expired
                  kind:
                    type: string
                    enum:
                      - login
                      - oauth
                  oauth_client_sid:
                    type: string
                    nullable: true
                  oauth_authorization_sid:
                    type: string
                    nullable: true
                  device:
                    type: string
                    nullable: true
                  ip_hash:
                    type: string
                    nullable: true
                  last_active_at:
                    type: string
                  expires_at:
                    type: string
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  is_current:
                    type: boolean
                required:
                  - sid
                  - team_sid
                  - user_sid
                  - status
                  - kind
                  - oauth_client_sid
                  - oauth_authorization_sid
                  - device
                  - ip_hash
                  - last_active_at
                  - expires_at
                  - created_at
                  - updated_at
                  - is_current
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchSslCertificatesRequest:
      type: object
      description: Request body of `search_ssl_certificates`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            domain:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Exact FQDN match (lowercased server-side); no full-text.
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - pending
                    - challenge
                    - active
                    - failed
                    - expired
                ne:
                  type: string
                  enum:
                    - pending
                    - challenge
                    - active
                    - failed
                    - expired
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - challenge
                      - active
                      - failed
                      - expired
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - pending
                      - challenge
                      - active
                      - failed
                      - expired
              additionalProperties: false
            expires_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: '"Expiring soon" view = { lte: <+30d> }.'
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - expires_at
                - status
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchSslCertificatesResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  domain:
                    type: string
                  status:
                    type: string
                    enum:
                      - pending
                      - challenge
                      - active
                      - failed
                      - expired
                  challenge:
                    type: object
                    nullable: true
                    properties:
                      type:
                        type: string
                        enum:
                          - http-01
                      token:
                        type: string
                      key_authorization:
                        type: string
                      well_known_path:
                        type: string
                      cname_target:
                        type: string
                      expires_at:
                        type: string
                        nullable: true
                    required:
                      - type
                      - token
                      - key_authorization
                      - well_known_path
                      - cname_target
                      - expires_at
                  issuer:
                    type: string
                    nullable: true
                  issued_at:
                    type: string
                    nullable: true
                  expires_at:
                    type: string
                    nullable: true
                  last_error:
                    type: string
                    nullable: true
                  provider:
                    type: string
                    nullable: true
                    description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
                  cname_target:
                    type: string
                    nullable: true
                    description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                      team_sid:
                        type: string
                      permissions:
                        type: object
                        additionalProperties: {}
                      request_sid:
                        type: string
                        nullable: true
                      reason:
                        type: string
                        nullable: true
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                      - reason
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - domain
                  - status
                  - challenge
                  - issuer
                  - issued_at
                  - expires_at
                  - last_error
                  - provider
                  - cname_target
                  - created_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchSupportRequestsRequest:
      type: object
      description: Request body of `search_support_requests`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            team_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: Scoped by JWT; explicit override only for internal-support.
            user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: 'The requester: "what did Jane escalate?".'
            source:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - copilot
                    - app
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - copilot
                      - app
              additionalProperties: false
            reason:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - user_requested
                    - copilot_unable
                    - other
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - user_requested
                      - copilot_unable
                      - other
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - received
                    - handed_off
                    - handoff_failed
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - received
                      - handed_off
                      - handoff_failed
              additionalProperties: false
              description: received / handoff_failed = not yet in the support inbox.
            copilot_session_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: The copilot session an escalation came from.
            created_at:
              type: object
              properties:
                eq:
                  type: string
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            handed_off_at:
              type: object
              properties:
                eq:
                  type: string
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - handed_off_at
                - status
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchSupportRequestsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  user_sid:
                    type: string
                  contact_email:
                    type: string
                  source:
                    type: string
                    enum:
                      - copilot
                      - app
                  reason:
                    type: string
                    enum:
                      - user_requested
                      - copilot_unable
                      - other
                  subject:
                    type: string
                  body:
                    type: string
                  copilot_session_sid:
                    type: string
                    nullable: true
                  status:
                    type: string
                    enum:
                      - received
                      - handed_off
                      - handoff_failed
                  intercom_ticket_id:
                    type: string
                    nullable: true
                  handed_off_at:
                    type: string
                    nullable: true
                  last_error:
                    type: string
                    nullable: true
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                      team_sid:
                        type: string
                      permissions:
                        type: object
                        additionalProperties: {}
                      reason:
                        type: string
                        nullable: true
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                      - reason
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - sid
                  - team_sid
                  - user_sid
                  - contact_email
                  - source
                  - reason
                  - subject
                  - copilot_session_sid
                  - status
                  - intercom_ticket_id
                  - handed_off_at
                  - last_error
                  - created_by
                  - created_at
                  - updated_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties: {}
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchTeamMembersRequest:
      type: object
      description: Request body of `search_team_members`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = pending invites (not yet accepted).
            email:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - invited
                    - active
                    - revoked
                ne:
                  type: string
                  enum:
                    - invited
                    - active
                    - revoked
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - invited
                      - active
                      - revoked
                nin:
                  type: array
                  items:
                    type: string
                    enum:
                      - invited
                      - active
                      - revoked
              additionalProperties: false
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
            q:
              type: string
              description: Full-text LIKE (prefix/infix) over member email.
        include:
          type: array
          items:
            type: string
            enum:
              - user
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - updated_at
                - email
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchTeamMembersResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  team_sid:
                    type: string
                  user_sid:
                    type: string
                    nullable: true
                  email:
                    type: string
                  status:
                    type: string
                    enum:
                      - invited
                      - active
                      - revoked
                  permissions:
                    type: array
                    items:
                      type: string
                  account_sids:
                    type: array
                    nullable: true
                    items:
                      type: string
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - team_sid
                  - user_sid
                  - email
                  - status
                  - permissions
                  - account_sids
                  - created_by
                  - created_at
                  - updated_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    SearchTeamsRequest:
      type: object
      description: Request body of `search_teams`.
      properties:
        filter:
          type: object
          properties:
            sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
            owner_user_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
              additionalProperties: false
              description: '"teams I own".'
            subscription_sid:
              type: object
              properties:
                eq:
                  type: string
                in:
                  type: array
                  items:
                    type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: is_null:true = teams with no applied subscription.
            status:
              type: object
              properties:
                eq:
                  type: string
                  enum:
                    - active
                    - suspended
                ne:
                  type: string
                  enum:
                    - active
                    - suspended
                in:
                  type: array
                  items:
                    type: string
                    enum:
                      - active
                      - suspended
              additionalProperties: false
            q:
              type: string
              description: Full-text LIKE (prefix/infix) over team name.
            created_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                gt:
                  type: string
                lt:
                  type: string
              additionalProperties: false
            deleted_at:
              type: object
              properties:
                gte:
                  type: string
                lte:
                  type: string
                is_null:
                  type: boolean
              additionalProperties: false
              description: "Default scope is { is_null: true } (live rows)."
        include:
          type: array
          items:
            type: string
            enum:
              - subscription
              - owner
              - members_counts
          description: Relations to eager-load (see entity Includes).
        sort:
          type: object
          properties:
            field:
              type: string
              enum:
                - created_at
                - updated_at
                - name
            direction:
              type: string
              enum:
                - asc
                - desc
              description: Default desc.
          required:
            - field
        page_size:
          type: integer
          minimum: 0
          maximum: 500
          description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst.
        cursor:
          type: string
          nullable: true
          description: Opaque forward cursor from a previous response pagination.next_cursor.
    SearchTeamsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - search
        items:
          type: array
          items:
            type: object
            properties:
              item:
                type: object
                properties:
                  sid:
                    type: string
                  owner_user_sid:
                    type: string
                  subscription_sid:
                    type: string
                    nullable: true
                  name:
                    type: string
                  status:
                    type: string
                    enum:
                      - active
                      - suspended
                  plan:
                    type: string
                    nullable: true
                    enum:
                      - none
                      - free
                      - paid
                      - partner
                    description: "The plan kind, derived by the same recompute that writes status and limits: none, free, paid or partner. Null on a workspace that has not been recomputed since plans were stored; read it as unknown."
                  cluster_id:
                    type: integer
                    description: "Which cluster holds the workspace's LinkedIn and calendar data, assigned once at create and never writable. A routing fact: nothing a caller sends depends on it."
                  limits:
                    type: object
                    properties:
                      accounts:
                        type: number
                      cloud_browser:
                        type: number
                      webhooks:
                        type: number
                    required:
                      - accounts
                      - cloud_browser
                      - webhooks
                  config:
                    type: object
                    nullable: true
                    properties:
                      timezone:
                        type: string
                        nullable: true
                        description: IANA tz for team-scoped scheduling defaults.
                  created_by:
                    type: object
                    properties:
                      actor_type:
                        type: string
                        enum:
                          - user
                          - support
                          - api_key
                          - system
                          - agent
                      actor_sid:
                        type: string
                        nullable: true
                      team_sid:
                        type: string
                      actor_name:
                        type: string
                        nullable: true
                        description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                      oauth_client_sid:
                        type: string
                        nullable: true
                        description: The acting OAuth client (id_oc_*); null off the OAuth path.
                      reason:
                        type: string
                        nullable: true
                        description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                      permissions:
                        type: object
                        additionalProperties: {}
                        description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                      cluster_id:
                        type: integer
                        nullable: true
                        description: "Internal audit context: the cluster that served the write."
                      trace_id:
                        type: string
                        nullable: true
                        description: "Internal audit context: the trace id of the request that wrote the row."
                    required:
                      - actor_type
                      - actor_sid
                      - team_sid
                      - permissions
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  data_deletion_at:
                    type: string
                    nullable: true
                  deletion_warned_at:
                    type: string
                    nullable: true
                  deleted_at:
                    type: string
                    nullable: true
                required:
                  - sid
                  - owner_user_sid
                  - subscription_sid
                  - name
                  - status
                  - plan
                  - cluster_id
                  - limits
                  - config
                  - created_by
                  - created_at
                  - updated_at
                  - data_deletion_at
                  - deletion_warned_at
                  - deleted_at
              included:
                type: object
                additionalProperties: {}
            required:
              - item
              - included
        pagination:
          type: object
          properties:
            next_cursor:
              type: string
              nullable: true
            has_more:
              type: boolean
            total_count:
              type: integer
              nullable: true
          required:
            - next_cursor
            - has_more
            - total_count
        applied_filters:
          type: object
          additionalProperties: {}
        includes:
          type: array
          items:
            type: string
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
        counts:
          type: object
          properties:
            total_count:
              type: number
            groups:
              type: object
              additionalProperties: {}
          required:
            - total_count
            - groups
      required:
        - success
        - operation
        - items
        - pagination
        - applied_filters
        - includes
        - meta
    TransferTeamOwnershipRequest:
      type: object
      description: Request body of `transfer_team_ownership`.
      properties:
        new_owner_user_sid:
          type: string
          minLength: 18
          maxLength: 18
          pattern: ^us_mb_
          description: User sid (us_mb_…); must be an active member of this team.
      required:
        - new_owner_user_sid
    TransferTeamOwnershipResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            subscription_sid:
              type: string
              nullable: true
            name:
              type: string
            status:
              type: string
              enum:
                - active
                - suspended
            plan:
              type: string
              nullable: true
              enum:
                - none
                - free
                - paid
                - partner
              description: "The plan kind, derived by the same recompute that writes status and limits: none, free, paid or partner. Null on a workspace that has not been recomputed since plans were stored; read it as unknown."
            cluster_id:
              type: integer
              description: "Which cluster holds the workspace's LinkedIn and calendar data, assigned once at create and never writable. A routing fact: nothing a caller sends depends on it."
            limits:
              type: object
              properties:
                accounts:
                  type: number
                cloud_browser:
                  type: number
                webhooks:
                  type: number
              required:
                - accounts
                - cloud_browser
                - webhooks
            config:
              type: object
              nullable: true
              properties:
                timezone:
                  type: string
                  nullable: true
                  description: IANA tz for team-scoped scheduling defaults.
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            data_deletion_at:
              type: string
              nullable: true
            deletion_warned_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - subscription_sid
            - name
            - status
            - plan
            - cluster_id
            - limits
            - config
            - created_by
            - created_at
            - updated_at
            - data_deletion_at
            - deletion_warned_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    UnapplyBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    UndoCancelBillingSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - action
        action:
          type: string
          description: kebab-case verb; matches the route segment.
        item:
          type: object
          nullable: true
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            team_sid:
              type: string
              nullable: true
            paddle_subscription_id:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - active
                - past_due
                - paused
                - canceled
            collection_mode:
              type: string
              enum:
                - automatic
                - manual
            price_sid:
              type: string
            quantity:
              type: number
            addons:
              type: array
              items:
                type: object
                properties:
                  product_sid:
                    type: string
                  price_sid:
                    type: string
                  paddle_item_id:
                    type: string
                    nullable: true
                  quantity:
                    type: number
                  status:
                    type: string
                    enum:
                      - active
                      - canceled
                required:
                  - product_sid
                  - price_sid
                  - paddle_item_id
                  - quantity
                  - status
            currency:
              type: string
            current_period_starts_at:
              type: string
              nullable: true
            current_period_ends_at:
              type: string
              nullable: true
            next_billed_at:
              type: string
              nullable: true
            paused_at:
              type: string
              nullable: true
            scheduled_resume_at:
              type: string
              nullable: true
            scheduled_change:
              type: object
              nullable: true
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - pause
                    - resume
                effective_at:
                  type: string
                resume_at:
                  type: string
                  nullable: true
              required:
                - action
                - effective_at
                - resume_at
            canceled_at:
              type: string
              nullable: true
            canceled_by:
              type: object
              nullable: true
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - team_sid
            - paddle_subscription_id
            - status
            - collection_mode
            - price_sid
            - quantity
            - addons
            - currency
            - current_period_starts_at
            - current_period_ends_at
            - next_billed_at
            - paused_at
            - scheduled_resume_at
            - scheduled_change
            - canceled_at
            - canceled_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - action
        - item
        - result
        - meta
    UpdateApiKeyRequest:
      type: object
      description: Request body of `update_api_key`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        permissions:
          type: array
          items:
            type: string
            maxLength: 128
          description: FULL replacement of the key's permission list.
        account_sids:
          type: array
          nullable: true
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^(ln_ac_|em_ac_)
          minItems: 1
          description: FULL replacement of the key's account slice; null = all team accounts. An empty list is refused (422).
    UpdateApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
            token_prefix:
              type: string
            token_last4:
              type: string
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
                - expired
            expires_at:
              type: string
              nullable: true
            last_used_at:
              type: string
              nullable: true
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            plaintext_token:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - token_prefix
            - token_last4
            - permissions
            - account_sids
            - status
            - expires_at
            - last_used_at
            - created_by
            - created_at
            - updated_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateCurrentUserRequest:
      type: object
      description: Request body of `update_current_user`.
      properties:
        first_name:
          type: string
          minLength: 1
          maxLength: 100
        last_name:
          type: string
          nullable: true
          maxLength: 100
        avatar_url:
          type: string
          nullable: true
          maxLength: 1024
        phone:
          type: string
          nullable: true
          maxLength: 32
        timezone:
          type: string
          nullable: true
          description: IANA tz, e.g. "Europe/Riga".
        country:
          type: string
          nullable: true
          minLength: 2
          maxLength: 2
          description: ISO 3166-1 alpha-2.
        config:
          type: object
          properties:
            latest_team_sid:
              type: string
              nullable: true
              description: Which workspace to open on load (ts_tm_…); NOT default_team_sid.
            setup_completed:
              type: boolean
              description: The post-signup wizard is finished (or its last step was skipped).
            setup_step:
              type: string
              nullable: true
              enum:
                - verify
                - questions
                - workspace
                - linkedin
                - call
              description: Resume point inside the wizard; null = not started.
            onboarding_completed:
              type: boolean
            onboarding_steps:
              type: array
              items:
                type: string
            locale:
              type: string
              nullable: true
              maxLength: 8
    UpdateCurrentUserResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            default_team_sid:
              type: string
              nullable: true
            email:
              type: string
            email_status:
              type: string
              enum:
                - unverified
                - verified
            auth_provider:
              type: string
              enum:
                - password
                - google
            first_name:
              type: string
            last_name:
              type: string
              nullable: true
            avatar_url:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
            timezone:
              type: string
              nullable: true
            country:
              type: string
              nullable: true
            config:
              type: object
              nullable: true
              properties:
                latest_team_sid:
                  type: string
                  nullable: true
                  description: Which workspace to open on load (ts_tm_…); NOT default_team_sid.
                setup_completed:
                  type: boolean
                  description: The post-signup wizard is finished (or its last step was skipped).
                setup_step:
                  type: string
                  nullable: true
                  enum:
                    - verify
                    - questions
                    - workspace
                    - linkedin
                    - call
                  description: Resume point inside the wizard; null = not started.
                setup_call_step:
                  type: boolean
                  nullable: true
                  description: "Read-only. Whether this user's wizard includes step 04 (intro call): null = not scored yet, so it is offered. Server-computed from the step 02 sender bracket; silently dropped if sent to update."
                onboarding_completed:
                  type: boolean
                onboarding_steps:
                  type: array
                  items:
                    type: string
                locale:
                  type: string
                  nullable: true
                  maxLength: 8
            utm:
              type: object
              nullable: true
              additionalProperties:
                type: string
            created_at:
              type: string
            updated_at:
              type: string
            erasure_requested_at:
              type: string
              nullable: true
            erased_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - default_team_sid
            - email
            - email_status
            - auth_provider
            - first_name
            - last_name
            - avatar_url
            - phone
            - timezone
            - country
            - config
            - utm
            - created_at
            - updated_at
            - erasure_requested_at
            - erased_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateEmailBoxRequest:
      type: object
      description: Request body of `update_email_box`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The new label, 1 to 60 characters.
      required:
        - name
    UpdateEmailBoxResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            name:
              type: string
              description: The label the customer chose; "Server N" when nobody did.
            plan:
              type: string
              enum:
                - starter
                - growth
                - agency
                - dedicated
              description: "Mailboxes per plan: starter 100, growth 500, agency 2000, dedicated 10000."
            location:
              type: string
              nullable: true
              enum:
                - hel1
                - fsn1
                - nbg1
              description: Null on a server older than the choice.
            status:
              type: string
              enum:
                - provisioning
                - active
                - suspended
                - resizing
                - destroying
                - destroyed
                - failed
              description: resizing from the moment a plan change is accepted, destroying from the moment a delete is.
            suspended_reason:
              type: string
              nullable: true
              enum:
                - payment_failed
                - unpaid
              description: "payment_failed: the subscription is past due beyond its grace, or paused. unpaid: more servers of the plan than paid units."
            destroy_at:
              type: string
              nullable: true
              description: "ISO 8601 UTC, on a server suspended for billing: when it is deleted with every mailbox on it unless it is paid for again. Set with the first warning mail, seven days ahead; a final warning sent late moves it. Null otherwise, and once it is paid for again."
            complimentary:
              type: boolean
              description: The server granted without a paid unit; it cannot be resized or deleted.
            seats_cap:
              type: integer
              minimum: 0
              description: Mailboxes the server can hold.
            seats_used:
              type: integer
              minimum: 0
              description: Mailboxes it holds now.
            ipv4:
              type: string
              nullable: true
            release:
              type: string
              nullable: true
              description: The gtm.service.email release the server runs.
            run:
              type: object
              nullable: true
              properties:
                verb:
                  type: string
                  description: provision, rescale, migrate, suspend, resume, destroy, rotate_secrets, tenant_push or move_accounts.
                status:
                  type: string
                  description: pending, running, succeeded, failed or cancelled. failed is terminal until retry_email_box_run resumes it.
                phase:
                  type: string
                  nullable: true
                phase_index:
                  type: integer
                  minimum: 0
                  description: 1-based among phase_count; 0 before the first phase started.
                phase_count:
                  type: integer
                  minimum: 0
                started_at:
                  type: string
                  nullable: true
                error_code:
                  type: string
                  nullable: true
              required:
                - verb
                - status
                - phase
                - phase_index
                - phase_count
                - started_at
                - error_code
              description: The newest unfinished lifecycle run of the server, else its newest run when that one failed, else null.
            price:
              type: object
              nullable: true
              properties:
                amount:
                  type: string
                  description: Decimal string, e.g. "49.00".
                currency:
                  type: string
                  description: ISO 4217.
                interval:
                  type: string
                  description: month or year.
              required:
                - amount
                - currency
                - interval
              description: The plan's unit price on the subscription's cycle. Null for the complimentary server, without a live subscription and once the server is leaving.
            renews_at:
              type: string
              nullable: true
              description: The subscription's next billing date.
            paid_through:
              type: string
              nullable: true
              description: "Set by a delete: the end of the period the server was paid for."
            failed_error_code:
              type: string
              nullable: true
            created_at:
              type: string
              nullable: true
            provisioned_at:
              type: string
              nullable: true
            suspended_at:
              type: string
              nullable: true
            updated_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - plan
            - location
            - status
            - suspended_reason
            - complimentary
            - seats_cap
            - seats_used
            - ipv4
            - release
            - run
            - price
            - renews_at
            - paid_through
            - failed_error_code
            - created_at
            - provisioned_at
            - suspended_at
            - updated_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateOauthAuthorizationRequest:
      type: object
      description: Request body of `update_oauth_authorization`.
      properties:
        team_scope_mode:
          type: string
          enum:
            - selected
            - all_my_teams
        consented_team_sids:
          type: array
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ts_tm_
          description: FULL replacement; required + non-empty when the effective mode is selected; ignored for all_my_teams.
        permissions:
          type: array
          items:
            type: string
            maxLength: 128
          description: FULL replacement; MUST be ⊆ the client's permission ceiling.
    UpdateOauthAuthorizationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            user_sid:
              type: string
            oauth_client_sid:
              type: string
            team_scope_mode:
              type: string
              enum:
                - selected
                - all_my_teams
            consented_team_sids:
              type: array
              items:
                type: string
            permissions:
              type: array
              items:
                type: string
            status:
              type: string
              enum:
                - active
                - revoked
            last_used_at:
              type: string
              nullable: true
            created_at:
              type: string
            updated_at:
              type: string
          required:
            - sid
            - user_sid
            - oauth_client_sid
            - team_scope_mode
            - consented_team_sids
            - permissions
            - status
            - last_used_at
            - created_at
            - updated_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateOauthClientRequest:
      type: object
      description: Request body of `update_oauth_client`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        redirect_uris:
          type: array
          items:
            type: string
            maxLength: 2048
            format: uri
            pattern: ^https:\/\/
          minItems: 1
          description: FULL replacement of the exact-match https allow-list.
        permissions:
          type: array
          items:
            type: string
            maxLength: 128
          description: FULL replacement of the permission ceiling.
        grant_types:
          type: array
          items:
            type: string
            enum:
              - authorization_code
              - refresh_token
          minItems: 1
        actor_kind:
          type: string
          enum:
            - agent
            - integration
          description: Reclassify the client; only tokens minted after the change carry the new kind.
        status:
          type: string
          enum:
            - active
            - disabled
          description: disabled cascade-revokes the client's grants + issued tokens.
    UpdateOauthClientResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
              nullable: true
            name:
              type: string
            client_id:
              type: string
            redirect_uris:
              type: array
              items:
                type: string
            grant_types:
              type: array
              items:
                type: string
                enum:
                  - authorization_code
                  - refresh_token
            permissions:
              type: array
              items:
                type: string
            is_confidential:
              type: boolean
            registration_kind:
              type: string
              enum:
                - manual
                - dynamic
            actor_kind:
              type: string
              nullable: true
              enum:
                - agent
                - integration
              description: "What acts through the client: agent (an AI agent that registered itself or was registered as one) or integration (an app a person set up). Null = unclassified, a client from before the field (2026-08-02), never backfilled."
            status:
              type: string
              enum:
                - active
                - disabled
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
            client_secret:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - client_id
            - redirect_uris
            - grant_types
            - permissions
            - is_confidential
            - registration_kind
            - actor_kind
            - status
            - created_by
            - created_at
            - updated_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateSslCertificateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            domain:
              type: string
            status:
              type: string
              enum:
                - pending
                - challenge
                - active
                - failed
                - expired
            challenge:
              type: object
              nullable: true
              properties:
                type:
                  type: string
                  enum:
                    - http-01
                token:
                  type: string
                key_authorization:
                  type: string
                well_known_path:
                  type: string
                cname_target:
                  type: string
                expires_at:
                  type: string
                  nullable: true
              required:
                - type
                - token
                - key_authorization
                - well_known_path
                - cname_target
                - expires_at
            issuer:
              type: string
              nullable: true
            issued_at:
              type: string
              nullable: true
            expires_at:
              type: string
              nullable: true
            last_error:
              type: string
              nullable: true
            provider:
              type: string
              nullable: true
              description: "The edge provider that issued the certificate, where one does; always null here: the platform issues it itself."
            cname_target:
              type: string
              nullable: true
              description: "The CNAME target an edge provider deals for the domain; always null here: the target to point at is challenge.cname_target."
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                team_sid:
                  type: string
                permissions:
                  type: object
                  additionalProperties: {}
                request_sid:
                  type: string
                  nullable: true
                reason:
                  type: string
                  nullable: true
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
                - reason
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - domain
            - status
            - challenge
            - issuer
            - issued_at
            - expires_at
            - last_error
            - provider
            - cname_target
            - created_by
            - created_at
            - updated_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateTeamMemberRequest:
      type: object
      description: Request body of `update_team_member`.
      properties:
        permissions:
          type: array
          items:
            type: string
            enum:
              - can_view_teams
              - can_manage_teams
              - can_view_team_members
              - can_manage_team_members
              - can_view_api_keys
              - can_manage_api_keys
              - can_view_oauth_clients
              - can_manage_oauth_clients
              - can_view_sessions
              - can_manage_sessions
              - can_view_account_shares
              - can_manage_account_shares
              - can_manage_account_transfers
              - can_view_billing
              - can_manage_billing
              - can_view_ssl_certificates
              - can_manage_ssl_certificates
              - can_view_notifications
              - can_manage_notifications
              - can_view_support_requests
              - can_manage_support_requests
              - can_view_linkedin_connections
              - can_act_linkedin_connections
              - can_view_linkedin_messages
              - can_act_linkedin_messages
              - can_act_linkedin_engagements
              - can_view_linkedin_searches
              - can_act_linkedin_searches
              - can_view_linkedin_enrichment
              - can_act_linkedin_enrichment
              - can_view_linkedin_accounts
              - can_update_linkedin_accounts
              - can_manage_linkedin_accounts
              - can_open_cloud_browser
              - can_change_proxy
              - can_edit_schedule
              - can_manage_smart_limits
              - can_manage_cloud_browser_external_links
              - can_share_vendor_profiles
              - can_act_linkedin_custom_requests
              - can_view_mass_actions
              - can_manage_mass_actions
              - can_view_webhooks
              - can_manage_webhooks
              - can_view_email_accounts
              - can_update_email_accounts
              - can_manage_email_accounts
              - can_view_email_messages
              - can_act_email_messages
              - can_view_email_engagements
              - can_view_email_suppressions
              - can_manage_email_suppressions
              - can_view_email_tracking_domains
              - can_manage_email_tracking_domains
              - can_view_email_sending_domains
              - can_manage_email_sending_domains
              - "*"
          description: Full replacement; the can_view_teams floor is always unioned in.
        account_sids:
          type: array
          nullable: true
          items:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^ln_ac_
            description: "Connected-account sid (ln_ac_…): a member profile-slice entry."
          minItems: 1
          description: null resets to "all profiles"; an empty list is refused (422).
    UpdateTeamMemberResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            team_sid:
              type: string
            user_sid:
              type: string
              nullable: true
            email:
              type: string
            status:
              type: string
              enum:
                - invited
                - active
                - revoked
            permissions:
              type: array
              items:
                type: string
            account_sids:
              type: array
              nullable: true
              items:
                type: string
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - user_sid
            - email
            - status
            - permissions
            - account_sids
            - created_by
            - created_at
            - updated_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
    UpdateTeamRequest:
      type: object
      description: Request body of `update_team`.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        config:
          type: object
          nullable: true
          properties:
            timezone:
              type: string
              nullable: true
              description: IANA tz for team-scoped scheduling defaults.
    UpdateTeamResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - update
        item:
          type: object
          properties:
            sid:
              type: string
            owner_user_sid:
              type: string
            subscription_sid:
              type: string
              nullable: true
            name:
              type: string
            status:
              type: string
              enum:
                - active
                - suspended
            plan:
              type: string
              nullable: true
              enum:
                - none
                - free
                - paid
                - partner
              description: "The plan kind, derived by the same recompute that writes status and limits: none, free, paid or partner. Null on a workspace that has not been recomputed since plans were stored; read it as unknown."
            cluster_id:
              type: integer
              description: "Which cluster holds the workspace's LinkedIn and calendar data, assigned once at create and never writable. A routing fact: nothing a caller sends depends on it."
            limits:
              type: object
              properties:
                accounts:
                  type: number
                cloud_browser:
                  type: number
                webhooks:
                  type: number
              required:
                - accounts
                - cloud_browser
                - webhooks
            config:
              type: object
              nullable: true
              properties:
                timezone:
                  type: string
                  nullable: true
                  description: IANA tz for team-scoped scheduling defaults.
            created_by:
              type: object
              properties:
                actor_type:
                  type: string
                  enum:
                    - user
                    - support
                    - api_key
                    - system
                    - agent
                actor_sid:
                  type: string
                  nullable: true
                team_sid:
                  type: string
                actor_name:
                  type: string
                  nullable: true
                  description: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
                oauth_client_sid:
                  type: string
                  nullable: true
                  description: The acting OAuth client (id_oc_*); null off the OAuth path.
                reason:
                  type: string
                  nullable: true
                  description: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
                permissions:
                  type: object
                  additionalProperties: {}
                  description: "Internal audit context: the grant set the actor held at write time. Not a contract."
                cluster_id:
                  type: integer
                  nullable: true
                  description: "Internal audit context: the cluster that served the write."
                trace_id:
                  type: string
                  nullable: true
                  description: "Internal audit context: the trace id of the request that wrote the row."
              required:
                - actor_type
                - actor_sid
                - team_sid
                - permissions
            created_at:
              type: string
            updated_at:
              type: string
            data_deletion_at:
              type: string
              nullable: true
            deletion_warned_at:
              type: string
              nullable: true
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - owner_user_sid
            - subscription_sid
            - name
            - status
            - plan
            - cluster_id
            - limits
            - config
            - created_by
            - created_at
            - updated_at
            - data_deletion_at
            - deletion_warned_at
            - deleted_at
        updated_fields:
          type: array
          items:
            type: string
        previous_values:
          type: object
          additionalProperties: {}
        meta:
          type: object
          properties:
            trace_id:
              type: string
              description: UUID v7; same 128-bit value as the X-Trace-Id header.
            span_id:
              type: string
              pattern: ^[0-9a-f]{16}$
              description: 16 hex chars, root span of this request.
            timestamp:
              type: string
              description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
            duration_ms:
              type: integer
              minimum: 0
              description: Server-side wall clock.
            team_sid:
              type: string
              nullable: true
              description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
            actor_type:
              type: string
              nullable: true
              description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
          required:
            - trace_id
            - span_id
            - timestamp
            - duration_ms
      required:
        - success
        - operation
        - item
        - updated_fields
        - previous_values
        - meta
