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

# Resend Events

> Synchronously resend the webhook batch with the provided batch_id for the customer. The result is returned in the
response.




## OpenAPI

````yaml /email-api/api-reference/openapi.yaml post /webhook-batch/{batch_id}/resend
openapi: 3.0.0
info:
  contact:
    email: support@mailchannels.com
    name: MailChannels Corporation
  description: >
    This is the API reference for Email API. Here, you'll find more detailed
    information on every endpoint, including parameters, response formats, and
    error codes.
  title: Email API
  version: 1.4.0
servers:
  - url: https://api.mailchannels.net/tx/v1
security: []
tags:
  - name: Send
  - name: DKIM
  - name: Metrics
  - name: Sub-accounts
  - name: Suppression
  - name: Webhooks
  - name: Usage
  - name: Custom Tracking
paths:
  /webhook-batch/{batch_id}/resend:
    post:
      tags:
        - Webhooks
      summary: Resend Events
      description: >
        Synchronously resend the webhook batch with the provided batch_id for
        the customer. The result is returned in the

        response.
      parameters:
        - description: the ID of the batch
          in: path
          name: batch_id
          required: true
          schema:
            type: integer
        - in: header
          name: X-Api-Key
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResendResponse'
          description: >
            Resend attempt completed. The result of the resend attempt is
            included in the response body.

            A successful response here does not mean the webhook endpoint
            responded with a 2xx status code,

            only that we were able to make the resend attempt and receive a
            response.
        '400':
          description: Bad Request. The batch ID is invalid.
        '404':
          description: The batch ID is not found for the customer.
        '500':
          description: Internal Server Error
      x-codeSamples:
        - label: Node.js
          lang: javascript
          source: >-
            import { MailChannels } from "mailchannels-sdk";


            const { MAILCHANNELS_API_KEY, BATCH_ID } = process.env;

            if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY
            before running");

            if (!BATCH_ID) throw new Error("Set BATCH_ID to the ID of the batch
            to resend");


            const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);


            const { data, error } = await
            mailchannels.webhooks.resendBatch(Number(BATCH_ID));


            if (error) {
              console.error("Resend webhook batch failed:", error);
              process.exit(1);
            }

            console.log(data);
        - label: Python
          lang: python
          source: |-
            import os
            import sys

            import mailchannels

            if not os.environ.get("MAILCHANNELS_API_KEY"):
                sys.exit("Set MAILCHANNELS_API_KEY before running")

            batch_id_str = os.environ.get("BATCH_ID")
            if not batch_id_str:
                sys.exit("Set BATCH_ID before running")

            # Resend a specific webhook batch.
            response = mailchannels.Webhooks.resend_batch(int(batch_id_str))

            print(response)
        - label: PHP
          lang: php
          source: >-
            <?php


            require_once __DIR__ . '/vendor/autoload.php';


            use MailChannels\Client;


            $api_key  = getenv('MAILCHANNELS_API_KEY') or exit("Error:
            MAILCHANNELS_API_KEY is not set\n");

            $batch_id = getenv('BATCH_ID') or exit("Error: BATCH_ID is not
            set\n");


            $client = new Client(apiKey: $api_key);


            $response = $client->webhooks->resendBatch((int) $batch_id);


            print_r($response->toArray());
components:
  schemas:
    WebhookResendResponse:
      properties:
        batch_id:
          description: |
            Unique identifier for the webhook batch
          format: int64
          minimum: 0
          type: integer
        created_at:
          description: Timestamp of when the webhook batch was created
          format: date-time
          type: string
        customer_handle:
          description: Customer handle associated with the webhook batch
          maxLength: 255
          type: string
        duration_in_ms:
          description: >
            Duration of the webhook batch in milliseconds, measured from the
            time the request was sent to the webhook

            endpoint until the response was received. Null indicates that no
            response was returned from the webhook

            endpoint.
          minimum: 0
          nullable: true
          type: integer
        event_count:
          description: Number of events in the webhook batch
          minimum: 0
          type: integer
        status_code:
          description: >
            HTTP status code returned by the webhook endpoint.

            Valid values are 100-599. Null indicates that no response was
            returned from the webhook endpoint.
          maximum: 599
          nullable: true
          type: integer
        webhook:
          description: Webhook URL to which events in the batch were posted
          type: string
      required:
        - batch_id
        - customer_handle
        - webhook
        - created_at
        - event_count
      type: object

````