> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gtm-api.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replay webhook deliveries

> Put the deliveries a broken endpoint left behind back on the wire: every webhook_logs row of this webhook created inside [from, to] whose status is in statuses (default failed + cancelled; success re-fires delivered events, opt-in) goes back to pending, oldest first, one row per second, and the normal scheduler delivers it under the same webhook_log_sid. Cancelled rows come back only when the platform cancelled them (webhook_failed / webhook_disabled / webhook_deleted), never an operator's manual cancel; rows in flight are never touched. from is required; the window spans at most 30 days and one call re-arms at most 5000 rows, refused with the cap named beyond either (narrow the window or statuses). Requires status=on: re-enable a failed webhook first (update_webhook status:'on'). Rate-limited to 10 calls/min per webhook. Re-delivers real events; state-changing.

Contract:
- MCP tool `replay_webhook`, registry package `mcp.orchestration/webhooks`, mount `orchestration.webhooks`.
- 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.



## OpenAPI

````yaml /api-reference/orchestration/openapi.yaml post /api/webhooks/{sid}/replay
openapi: 3.0.3
info:
  title: 'GTM API public contract: gtm.service.orchestration'
  description: >-
    The cross-service execution plane: the platform-wide webhook registry and
    delivery log, plus mass actions (preview, commit, pace, pause, resume,
    canary) and their per-item child rows.


    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.orchestration`, 23
    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/orchestration/v4
    description: Production, through the app.gtm-api.com gateway
security:
  - BearerJwt: []
    TeamSid: []
tags:
  - name: mass_action_items
    description: >-
      Registry package `mcp.orchestration/mass_action_items`, served on MCP
      mount `orchestration.mass_actions`.
  - name: mass_actions
    description: >-
      Registry package `mcp.orchestration/mass_actions`, served on MCP mount
      `orchestration.mass_actions`.
  - name: webhook_logs
    description: >-
      Registry package `mcp.orchestration/webhook_logs`, served on MCP mount
      `orchestration.webhooks`.
  - name: webhooks
    description: >-
      Registry package `mcp.orchestration/webhooks`, served on MCP mount
      `orchestration.webhooks`.
paths:
  /api/webhooks/{sid}/replay:
    post:
      tags:
        - webhooks
      summary: Replay webhook deliveries
      description: >-
        Put the deliveries a broken endpoint left behind back on the wire: every
        webhook_logs row of this webhook created inside [from, to] whose status
        is in statuses (default failed + cancelled; success re-fires delivered
        events, opt-in) goes back to pending, oldest first, one row per second,
        and the normal scheduler delivers it under the same webhook_log_sid.
        Cancelled rows come back only when the platform cancelled them
        (webhook_failed / webhook_disabled / webhook_deleted), never an
        operator's manual cancel; rows in flight are never touched. from is
        required; the window spans at most 30 days and one call re-arms at most
        5000 rows, refused with the cap named beyond either (narrow the window
        or statuses). Requires status=on: re-enable a failed webhook first
        (update_webhook status:'on'). Rate-limited to 10 calls/min per webhook.
        Re-delivers real events; state-changing.


        Contract:

        - MCP tool `replay_webhook`, registry package
        `mcp.orchestration/webhooks`, mount `orchestration.webhooks`.

        - 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.
      operationId: replay_webhook
      parameters:
        - name: sid
          in: path
          required: true
          description: Webhook sid (wh_hk_…).
          schema:
            type: string
            minLength: 18
            maxLength: 18
            pattern: ^wh_hk_
            description: Webhook sid (wh_hk_…).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplayWebhookRequest'
      responses:
        '200':
          description: '`action` success envelope.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplayWebhookResponse'
        4XX:
          $ref: '#/components/responses/McpClientError'
        5XX:
          $ref: '#/components/responses/McpServerError'
components:
  schemas:
    ReplayWebhookRequest:
      type: object
      description: Request body of `replay_webhook`.
      properties:
        from:
          type: string
          description: >-
            ISO 8601: the oldest created_at to re-arm. Required, a replay
            re-fires real deliveries.
        to:
          type: string
          description: ISO 8601; default now.
        statuses:
          type: array
          items:
            type: string
            enum:
              - failed
              - cancelled
              - success
          minItems: 1
          description: Default ['failed', 'cancelled']. success is opt-in.
        event_types:
          type: array
          items:
            type: string
            enum:
              - linkedin-accounts.created
              - linkedin-accounts.restored
              - linkedin-accounts.deleted
              - linkedin-accounts.initial-sync-started
              - linkedin-accounts.initial-sync-done
              - linkedin-accounts.initial-sync-held
              - linkedin-accounts.sync-reset
              - linkedin-accounts.sync-config-updated
              - linkedin-accounts.smart-limits-changed
              - linkedin-accounts.premium-changed
              - linkedin-accounts.login-succeeded
              - linkedin-accounts.login-failed
              - linkedin-accounts.logged-out
              - linkedin-accounts.recruiter-signed-out
              - linkedin-accounts.recruiter-signed-in
              - linkedin-accounts.heartbeat-stale
              - linkedin-accounts.subscription-hold-applied
              - linkedin-accounts.subscription-hold-released
              - linkedin-account-block-log.recorded
              - linkedin-account-snapshot.captured
              - linkedin-account-quota-hits.recorded
              - linkedin-account-smart-limits.limit-reached
              - linkedin-account-smart-limits.limit-released
              - linkedin-account-smart-limits.smart-limit-recomputed
              - linkedin-account-smart-limits.ceiling-learned
              - linkedin-connection-requests.sent
              - linkedin-connection-requests.accepted
              - linkedin-connection-requests.withdrawn
              - linkedin-connection-requests.expired-detected
              - linkedin-connection-requests.resend-available
              - linkedin-connection-requests.sync-completed
              - linkedin-connection-invitations.received
              - linkedin-connection-invitations.accepted
              - linkedin-connection-invitations.ignored
              - linkedin-connection-invitations.expired-detected
              - linkedin-connection-invitations.sync-completed
              - linkedin-connections.added
              - linkedin-connections.removed
              - linkedin-connections.sync-completed
              - linkedin-followers.added
              - linkedin-messages.received
              - linkedin-messages.sent
              - linkedin-messages.send-failed
              - linkedin-conversations.created
              - linkedin-conversations.sync-completed
              - data-requests.completed
              - data-requests.failed
              - linkedin-auto-scrape-runs.completed
              - linkedin-auto-scrape-runs.failed
              - linkedin-auto-scrapes.paused
              - antidetect-browsers.logged-in
              - antidetect-browsers.login-failed
              - antidetect-browsers.logged-out
              - antidetect-browsers.started
              - antidetect-browsers.stopped
              - antidetect-browsers.start-failed
              - antidetect-browsers.running-issue
              - antidetect-browsers.error-investigation
              - antidetect-browsers.maintenance
              - antidetect-browsers.proxy-issue
              - antidetect-browsers.proxy-back-alive
              - antidetect-browsers.idle
              - account-shares.created
              - account-shares.returned
              - account-shares.recalled
              - account-shares.failed
              - account-transfers.completed
              - account-transfers.failed
              - webhooks.failed
              - email-accounts.connected
              - email-accounts.reconnect-required
              - email-accounts.sending-paused
              - email-accounts.sending-resumed
              - email-accounts.disconnected
              - email-accounts.deleted
              - email-accounts.sync-completed
              - email-accounts.subscription-hold-applied
              - email-accounts.subscription-hold-released
              - email-messages.received
              - email-messages.sent
              - email-messages.bounced
              - email-messages.complained
              - email-messages.failed
              - email-messages.deleted
              - email-threads.updated
              - email-engagements.opened
              - email-engagements.clicked
              - email-engagements.unsubscribed
              - email-account-health.snapshot-captured
              - email-account-health.score-critical
              - email-suppressions.created
              - email-suppressions.deleted
              - email-tracking-domains.verified
              - email-tracking-domains.failed
              - email-sending-domains.verified
              - email-sending-domains.failed
              - mass-actions.created
              - mass-actions.paused
              - mass-actions.resumed
              - mass-actions.settled
          minItems: 1
          description: 'Default: every type.'
      required:
        - from
    ReplayWebhookResponse:
      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
            target_url:
              type: string
            events:
              type: array
              items:
                type: string
            filters:
              type: object
              additionalProperties: {}
            secret:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - 'on'
                - 'off'
                - failed
            consecutive_failed_attempts:
              type: number
            last_failure_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
            deleted_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
            deleted_at:
              type: string
              nullable: true
          required:
            - sid
            - team_sid
            - name
            - target_url
            - events
            - filters
            - status
            - consecutive_failed_attempts
            - last_failure_at
            - created_by
            - deleted_by
            - created_at
            - updated_at
            - deleted_at
        result:
          type: object
          properties:
            rows:
              type: integer
              description: Deliveries re-armed by this call.
            from:
              type: string
            to:
              type: string
            statuses:
              type: array
              items:
                type: string
                enum:
                  - failed
                  - cancelled
                  - success
            first_scheduled_at:
              type: string
              nullable: true
            last_scheduled_at:
              type: string
              nullable: true
              description: >-
                The backlog is fully dispatched by then: rows - 1 seconds after
                first_scheduled_at.
          required:
            - rows
            - from
            - to
            - statuses
            - first_scheduled_at
            - last_scheduled_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
    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
  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'
    McpServerError:
      description: >-
        MCP error envelope with `error.code` internal_error or
        service_unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/McpError'
  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.

````