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

# Replay a webhook delivery

> **Private beta:** [request access](https://trigger.dev/webhooks-beta) to use webhooks.
Route a delivery's stored event again as a new delivery. Without `targetId` every current subscriber is checked against its filter again. With `targetId` the event goes to that one subscriber, even if its filter skipped it. A replay never resumes waiting runs. Replays start real runs, so the key needs permission to trigger every task the replay runs, and to write sessions if it reaches an agent's subscriber.



## OpenAPI

````yaml v3-openapi POST /api/v1/webhooks/deliveries/{deliveryId}/replay
openapi: 3.1.0
info:
  title: Trigger.dev v3 REST API
  description: >-
    The REST API lets you trigger and manage runs on Trigger.dev. You can
    trigger a run, get the status of a run, and get the results of a run. 
  version: 2024-04
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.trigger.dev
    description: Trigger.dev API
security: []
paths:
  /api/v1/webhooks/deliveries/{deliveryId}/replay:
    parameters:
      - $ref: '#/components/parameters/webhookDeliveryId'
    post:
      tags:
        - webhooks
      summary: Replay a webhook delivery
      description: >-
        **Private beta:** [request access](https://trigger.dev/webhooks-beta) to
        use webhooks.

        Route a delivery's stored event again as a new delivery. Without
        `targetId` every current subscriber is checked against its filter again.
        With `targetId` the event goes to that one subscriber, even if its
        filter skipped it. A replay never resumes waiting runs. Replays start
        real runs, so the key needs permission to trigger every task the replay
        runs, and to write sessions if it reaches an agent's subscriber.
      operationId: replay_webhook_delivery_v1
      parameters:
        - in: query
          name: targetId
          schema:
            type: string
          required: false
          description: >-
            The subscriber to replay to: a `webhook()` task's id, or
            `agentId:eventId` for an agent's `chat.event` or channel. Listed in
            the endpoint's `subscribers`.
      responses:
        '200':
          description: Replay created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplayWebhookDeliveryResponse'
        '401':
          description: Unauthorized request
        '403':
          description: >-
            The key can't trigger a task (or write sessions for an agent) that
            the replay would run
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            The delivery, its endpoint, or the `targetId` subscriber doesn't
            exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - secretKey: []
      x-codeSamples:
        - lang: curl
          label: Replay to every subscriber
          source: >-
            curl -X POST
            "https://api.trigger.dev/api/v1/webhooks/deliveries/whd_1234/replay"
            \
              -H "Authorization: Bearer $TRIGGER_SECRET_KEY"
        - lang: curl
          label: Replay to one subscriber
          source: >-
            curl -X POST
            "https://api.trigger.dev/api/v1/webhooks/deliveries/whd_1234/replay?targetId=process-refund"
            \
              -H "Authorization: Bearer $TRIGGER_SECRET_KEY"
components:
  parameters:
    webhookDeliveryId:
      in: path
      name: deliveryId
      required: true
      schema:
        type: string
      description: The delivery's id, starts with `whd_`.
      example: whd_1234
  schemas:
    ReplayWebhookDeliveryResponse:
      type: object
      required:
        - deliveryId
        - replayedFrom
      properties:
        deliveryId:
          type: string
          description: >-
            The new delivery. Retrieve it once it's processed to see the runs it
            started.
          example: whd_5678
        replayedFrom:
          type: string
          description: The delivery that was replayed.
          example: whd_1234
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: Something went wrong
      required:
        - error
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      description: >
        Use a named environment API key. It starts with `tr_dev_sk_`,
        `tr_prod_sk_`, `tr_stg_sk_`, etc.


        Create a named API key in the API Keys section of your Trigger.dev
        project dashboard. Choose the narrowest access preset that supports your
        integration.


        Our TypeScript SDK will default to using the value of the
        `TRIGGER_SECRET_KEY` environment variable if it is set. If you are using
        the SDK in a different environment, you can set the key using the
        `configure` function.


        ```typescript

        import { configure } from "@trigger.dev/sdk";


        configure({ accessToken: "tr_dev_sk_1234" });

        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.