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

# Test webhook endpoint

> Send a test webhook notification to verify your endpoint is working correctly.

## Overview

This endpoint allows you to test your webhook implementation by sending a sample webhook payload to your registered endpoints. This is useful for:

- Verifying your webhook handler is working correctly
- Testing signature verification
- Debugging webhook processing logic
- Ensuring your endpoint can handle the expected payload structure

## How it works

1. **Provide shipment IDs** - Specify which shipments to use for the test
2. **Send test webhooks** - Teleship sends test notifications to all your enabled webhooks
3. **Verify results** - Check the response to see which webhooks were notified successfully

## Test Payload

The test webhook will send a `shipment.updated` event with real shipment data, allowing you to test with actual data structure.

## Response

The response includes:
- Overall success status
- Number of webhooks notified
- Detailed results for each shipment
- Any errors that occurred during testing

## Example Usage

```bash
curl -X POST "https://api.teleship.com/api/webhooks/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shipmentIds": ["ship_123", "ship_456"]
  }'
```

## Example Response

```json
{
  "success": true,
  "message": "Successfully tested webhooks for 2/2 shipments",
  "webhooksNotified": 4,
  "results": [
    {
      "shipmentId": "ship_123",
      "success": true,
      "message": "Test webhook sent successfully to 2 webhook(s)",
      "webhooksNotified": 2
    },
    {
      "shipmentId": "ship_456",
      "success": true,
      "message": "Test webhook sent successfully to 2 webhook(s)",
      "webhooksNotified": 2
    }
  ]
}
```

## Troubleshooting

If webhook tests fail:

1. **Check endpoint URL** - Ensure your webhook endpoint is accessible
2. **Verify signature handling** - Make sure your signature verification is working
3. **Check response time** - Ensure your endpoint responds within 30 seconds
4. **Review logs** - Check your webhook handler logs for errors
5. **Test manually** - Use tools like ngrok to test locally during development
    



## OpenAPI

````yaml /api-reference/openapi.json post /api/webhooks/test
openapi: 3.0.0
info:
  title: Teleship
  description: >

    Teleship is a leading cross-border logistics provider offering seamless
    global commerce solutions through our comprehensive API.


    With Teleship's API, developers can integrate our cross-border shipping
    services, trade engine, and logistics solutions directly into their
    applications.


    **Key Features:**

    - Cross-border shipping solutions for international commerce

    - Real-time shipping rates and delivery estimates

    - End-to-end shipment tracking with detailed status updates

    - Automated customs compliance and product classification

    - Real-time event notifications through webhooks


    **Why Teleship?**

    - API-first: Developer-friendly integration with comprehensive documentation

    - Enterprise-ready: Built for businesses of all sizes

    - Secure: Enterprise-grade security and compliance

    - Integrated: Seamless connection with e-commerce, ERP, and fulfillment
    systems


    Start shipping globally with Teleship's powerful cross-border logistics API.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.teleship.com
security: []
tags: []
paths:
  /api/webhooks/test:
    post:
      tags:
        - Shipping Services
      summary: Test webhook endpoint
      description: >-
        Send a test webhook notification to verify your endpoint is working
        correctly.


        ## Overview


        This endpoint allows you to test your webhook implementation by sending
        a sample webhook payload to your registered endpoints. This is useful
        for:


        - Verifying your webhook handler is working correctly

        - Testing signature verification

        - Debugging webhook processing logic

        - Ensuring your endpoint can handle the expected payload structure


        ## How it works


        1. **Provide shipment IDs** - Specify which shipments to use for the
        test

        2. **Send test webhooks** - Teleship sends test notifications to all
        your enabled webhooks

        3. **Verify results** - Check the response to see which webhooks were
        notified successfully


        ## Test Payload


        The test webhook will send a `shipment.updated` event with real shipment
        data, allowing you to test with actual data structure.


        ## Response


        The response includes:

        - Overall success status

        - Number of webhooks notified

        - Detailed results for each shipment

        - Any errors that occurred during testing


        ## Example Usage


        ```bash

        curl -X POST "https://api.teleship.com/api/webhooks/test" \
          -H "Authorization: Bearer YOUR_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{
            "shipmentIds": ["ship_123", "ship_456"]
          }'
        ```


        ## Example Response


        ```json

        {
          "success": true,
          "message": "Successfully tested webhooks for 2/2 shipments",
          "webhooksNotified": 4,
          "results": [
            {
              "shipmentId": "ship_123",
              "success": true,
              "message": "Test webhook sent successfully to 2 webhook(s)",
              "webhooksNotified": 2
            },
            {
              "shipmentId": "ship_456",
              "success": true,
              "message": "Test webhook sent successfully to 2 webhook(s)",
              "webhooksNotified": 2
            }
          ]
        }

        ```


        ## Troubleshooting


        If webhook tests fail:


        1. **Check endpoint URL** - Ensure your webhook endpoint is accessible

        2. **Verify signature handling** - Make sure your signature verification
        is working

        3. **Check response time** - Ensure your endpoint responds within 30
        seconds

        4. **Review logs** - Check your webhook handler logs for errors

        5. **Test manually** - Use tools like ngrok to test locally during
        development
            
      operationId: testWebhook
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestWebhookDto'
      responses:
        '200':
          description: Webhook test results
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Overall test success status
                  message:
                    type: string
                    description: Summary message
                  webhooksNotified:
                    type: number
                    description: Total number of webhooks notified
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        shipmentId:
                          type: string
                          description: Shipment ID tested
                        success:
                          type: boolean
                          description: Whether test succeeded for this shipment
                        message:
                          type: string
                          description: Result message for this shipment
                        webhooksNotified:
                          type: number
                          description: Number of webhooks notified for this shipment
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseMessagesDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseMessagesDto'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseMessagesDto'
      security:
        - bearer: []
components:
  schemas:
    TestWebhookDto:
      type: object
      properties:
        shipmentIds:
          description: Array of shipment IDs to test webhook notifications for
          example:
            - ship_123
            - ship_456
          type: array
          items:
            type: string
      required:
        - shipmentIds
    ResponseMessagesDto:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ErrorResponseDto'
      required:
        - messages
    ErrorResponseDto:
      type: object
      properties:
        code:
          type: number
        level:
          type: string
          enum:
            - error
            - warning
            - info
          example: error
          description: Error level
          default: error
        timestamp:
          format: date-time
          type: string
          example: '2024-01-01T00:00:00.00Z'
        message:
          type: string
          example: An error occurred
        details:
          example:
            - Missing required field
          type: array
          items:
            type: string
      required:
        - code
        - level
        - timestamp
        - message
        - details
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````