> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Send Test Event

POST https://api.captain.dev/v2/webhooks/endpoints/{endpoint_id}/test
Content-Type: application/json

Send one event's example payload to this endpoint only. The request is signed like a real event, and its payload has `data.test` set to `true` and placeholder ids. Use it to check the receiver's signature verification without starting a job.

The body is optional; `event_type` defaults to `job.completed`. Follow the result with the deliveries and attempts endpoints.

Reference: https://docs.captain.dev/reference/webhooks/endpoints/test

## Request

### Path parameters

- `endpoint_id` (string, required) — The endpoint's id (`whe_...`).

### Body (application/json)

This endpoint expects a WebhookTestRequest.

- `event_type` (string, optional, default: job.completed) — Which event's example payload to send. Defaults to `job.completed`.

## Response

### 202

Successful Response

- `endpoint_id` (string, required)
- `message_id` (string, required) — The test message's id. Use it with the attempts endpoint.
- `event_type` (enum, required)
  - Allowed values: `job.completed`, `job.completed_with_errors`, `job.failed`, `job.timed_out`, `job.cancelled`
- `test` (boolean, required)

## Errors

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 403 Forbidden Error

The connection is read-only and cannot change webhooks (MCP connections without write access).

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 404 Not Found Error

`Webhook endpoint not found.` The id does not exist, or belongs to another organization.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 422 Unprocessable Entity Error

A value was rejected. A route check returns `HTTP_ERROR` and names the value in `message`, for example `url must start with https://`. A malformed body returns `VALIDATION_ERROR` with one entry per field in `details`.

- `error` (string, required) — `HTTP_ERROR` when a route check rejected a value, `VALIDATION_ERROR` when the body is malformed.
- `message` (string, required) — What went wrong. For `HTTP_ERROR`, names the rejected value.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code. Present only on `HTTP_ERROR`.
- `details` (list of V2WebhooksEndpointsEndpointIdTestPostResponsesContentApplicationJsonSchemaDetailsItems, optional) — Present only on `VALIDATION_ERROR`: one entry per invalid field, with `type`, `loc` and `msg`.

### 429 Too Many Requests Error

`Too many webhook management requests. Try again shortly.` Retry after the `Retry-After` header.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 503 Service Unavailable Error

Webhooks are temporarily unavailable. Retry shortly.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

## Types

### V2WebhooksEndpointsEndpointIdTestPostResponsesContentApplicationJsonSchemaDetailsItems

## Examples

**Request**

```json
{
  "event_type": "job.failed"
}
```

**Response**

```json
{
  "endpoint_id": "whe_3f9a1c7e5b2d4a6c8e0f1a2b",
  "message_id": "msg_2mXr1aQe7Fh3Kc9Vt5Bn8LpWzD",
  "event_type": "job.failed",
  "test": true
}
```

**SDK Code**

```python Python
import requests

BASE_URL = "https://api.captain.dev"
API_KEY = "your_api_key"
ENDPOINT_ID = "whe_3f9a1c7e5b2d4a6c8e0f1a2b"

response = requests.post(
    f"{BASE_URL}/v2/webhooks/endpoints/{ENDPOINT_ID}/test",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "event_type": "job.failed"
    },
    timeout=30.0,
)
response.raise_for_status()
data = response.json()
print(f"Sent test {data['event_type']} as {data['message_id']}")

```

```typescript TypeScript
const BASE_URL = "https://api.captain.dev";
const API_KEY = "your_api_key";
const ENDPOINT_ID = "whe_3f9a1c7e5b2d4a6c8e0f1a2b";

const response = await fetch(`${BASE_URL}/v2/webhooks/endpoints/${ENDPOINT_ID}/test`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "event_type": "job.failed"
  }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status} ${await response.text()}`);
const data = await response.json();
console.log(`Sent test ${data.event_type} as ${data.message_id}`);

```