> ## 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.

# Validate Enrolled Webhook

> Validates whether your enrolled webhook(s) respond with an HTTP 2xx status code.
Sends a test request to each webhook containing your customer handle,
a hardcoded event type(test), a hardcoded sender email(test@mailchannels.com),a timestamp,
a request ID (provided or generated), and an SMTP ID.
The response includes the HTTP status code and body returned by each webhook.




## OpenAPI

````yaml /email-api/api-reference/openapi.yaml post /webhook/validate
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/validate:
    post:
      tags:
        - Webhooks
      summary: Validate Enrolled Webhook
      description: >
        Validates whether your enrolled webhook(s) respond with an HTTP 2xx
        status code.

        Sends a test request to each webhook containing your customer handle,

        a hardcoded event type(test), a hardcoded sender
        email(test@mailchannels.com),a timestamp,

        a request ID (provided or generated), and an SMTP ID.

        The response includes the HTTP status code and body returned by each
        webhook.
      parameters:
        - in: header
          name: X-Api-Key
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookValidationRequestBody'
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookValidationResults'
          description: |
            Webhook validation completed
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request. Provided request ID is too long.
        '404':
          description: No webhooks found for the account
        '500':
          description: Internal Server Error
      x-codeSamples:
        - label: Node.js
          lang: javascript
          source: >-
            import { MailChannels } from "mailchannels-sdk";


            const { MAILCHANNELS_API_KEY } = process.env;

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


            const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);


            const { data, error } = await mailchannels.webhooks.validate();


            if (error) {
              console.error("Validate webhook 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")

            # Send a test event to each enrolled webhook and report whether it
            responded

            # with a 2xx status. request_id is optional; if omitted, one is
            generated.

            response =
            mailchannels.Webhooks.validate(request_id="test_request_1")


            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");


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


            // Send a test event to each enrolled webhook and report whether it
            responded

            // with a 2xx status. request_id is optional; if omitted, one is
            generated.

            $response = $client->webhooks->validate(requestId:
            'test_request_1');


            print_r($response->toArray());
components:
  schemas:
    WebhookValidationRequestBody:
      properties:
        request_id:
          description: |
            Optional identifier in the webhook payload.
            If not provided, a value will be automatically generated.
          maxLength: 28
          type: string
      type: object
    WebhookValidationResults:
      properties:
        all_passed:
          description: |
            Indicates whether all webhook validations passed
          type: boolean
        results:
          description: >
            Detailed results for each tested webhook, including whether it
            returned a 2xx status code,

            along with its response status code and body.
          items:
            $ref: '#/components/schemas/WebhookValidationResult'
          type: array
      required:
        - all_passed
        - results
      type: object
    ErrorResponse:
      properties:
        errors:
          description: >
            This is an array error objects that provide machine and human
            readable descriptions of the errors.
          items:
            type: string
          type: array
      type: object
    WebhookValidationResult:
      properties:
        response:
          $ref: '#/components/schemas/WebhookResponse'
        result:
          description: |
            Indicates whether the webhook responded with a 2xx HTTP status code
          enum:
            - passed
            - failed
          type: string
        webhook:
          description: |
            The webhook that was validated
          type: string
      required:
        - result
        - webhook
        - response
      type: object
    WebhookResponse:
      description: >
        The HTTP response returned by the webhook, including status code and
        response body.

        A null value indicates no response was received.

        Possible reasons include timeouts, connection failures, or other
        network-related issues.
      nullable: true
      properties:
        body:
          description: |
            Response body from webhook.
            Returns an error if unprocessable or too large.
          type: string
        status:
          description: |
            HTTP status code returned by the webhook
          example: 200
          type: integer
      required:
        - status
      type: object

````