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

# Test Webhook

> Send a test webhook to verify your endpoint is working

# Test Webhook

Sends a test webhook to a specified URL. Use this to verify your webhook endpoint is reachable, correctly processes the payload, and returns a `2xx` HTTP status.

<Note>
  Test webhooks are sent ad-hoc and **do not appear** in the dashboard's "Webhook Logs" view. They also use a placeholder payload with mock invoice/payment/settlement data — the values are not real. Use this endpoint to validate your signature verification and routing logic, then test the real payload shapes by paying a small invoice on a low-fee chain.
</Note>

## Request Body

<ParamField body="webhookUrl" type="string" required>
  The URL to send the test webhook to. Must be a valid HTTPS URI.
</ParamField>

<ParamField body="eventType" type="string" default="invoice.settled">
  The event type to simulate. If omitted, an `invoice.settled` test event is sent.

  Available options: `invoice.confirmed`, `invoice.settled`, `invoice.expired`, `invoice.overpaid`, `invoice.underpaid`
</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="Result">
    <ResponseField name="success" type="boolean">
      Whether the test webhook was delivered successfully (received a `2xx` response from your endpoint).
    </ResponseField>

    <ResponseField name="statusCode" type="number">
      HTTP status code returned by your endpoint.
    </ResponseField>

    <ResponseField name="eventId" type="string">
      ID of the test event that was sent (e.g. `evt_test_1776195221216`).
    </ResponseField>

    <ResponseField name="message" type="string">
      Result description.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.settlx.io/api/v1/webhooks/test \
    -H "Authorization: Bearer pk_live_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "webhookUrl": "https://yoursite.com/webhooks/settlx",
      "eventType": "invoice.settled"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.settlx.io/api/v1/webhooks/test', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer pk_live_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      webhookUrl: 'https://yoursite.com/webhooks/settlx',
      eventType: 'invoice.confirmed'
    })
  });
  const { data } = await response.json();

  if (data.success) {
    console.log('Webhook endpoint is working correctly!');
  } else {
    console.error(`Test failed: ${data.message}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 (success) theme={null}
  {
    "data": {
      "success": true,
      "statusCode": 200,
      "eventId": "evt_test_1776195221216",
      "message": "Test webhook delivered successfully"
    }
  }
  ```

  ```json 200 (endpoint returned error) theme={null}
  {
    "data": {
      "success": false,
      "statusCode": 500,
      "eventId": "evt_test_1776195221217",
      "message": "Failed to deliver test webhook: endpoint returned 500"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Bad Request",
    "message": "webhookUrl is required"
  }
  ```
</ResponseExample>
