# Send a test webhook

Send a test webhook

`POST https://api.cadmospay.com/machine/v1/gateway/webhooks/test`

Queues a signed gateway.test event to your registered callback. Keep requestId to retry. Read deliveries to check its outcome. This event never represents a payment.

## Authentication

`Authorization: Bearer <accessToken>`

The `accessToken` from `POST /v1/external-auth/token`, valid 15 minutes.

## Example requests

```bash
curl --fail-with-body 'https://api.cadmospay.com/machine/v1/gateway/webhooks/test' \
  -H "Authorization: Bearer ${CADMOS_ACCESS_TOKEN:?Set CADMOS_ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  --data-binary @- <<JSON
{
  "requestId": "${REQUEST_ID:?Set REQUEST_ID}"
}
JSON
```

```javascript
const { CADMOS_ACCESS_TOKEN, REQUEST_ID } = process.env;
if (!CADMOS_ACCESS_TOKEN || !REQUEST_ID) {
  throw new Error("Set CADMOS_ACCESS_TOKEN and REQUEST_ID");
}

const url = new URL("https://api.cadmospay.com/machine/v1/gateway/webhooks/test");
const body = {
  "requestId": REQUEST_ID
};
const response = await fetch(url, {
  method: "POST",
  redirect: "error",
  headers: {
    Authorization: "Bearer " + CADMOS_ACCESS_TOKEN,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
});
console.log(response.status, await response.json());
```

```python
from http.client import HTTPSConnection
import json
import os

conn = HTTPSConnection("api.cadmospay.com", timeout=30)
path = "/machine/v1/gateway/webhooks/test"
body = json.dumps({
  "requestId": os.environ["REQUEST_ID"]
})
headers = {
    "Authorization": "Bearer " + os.environ["CADMOS_ACCESS_TOKEN"],
    "Content-Type": "application/json",
}
conn.request("POST", path, body=body, headers=headers)
response = conn.getresponse()
print(response.status, response.read().decode())
conn.close()
```

## Request body

`application/json`

[TestWebhookRequest](https://cadmospay.com/developers/schemas/test-webhook-request.md)

Only the listed properties are accepted.

- `requestId` (string, required, pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$). 

## Responses

### 202

Send a test webhook

[WebhookDelivery](https://cadmospay.com/developers/schemas/webhook-delivery.md)

```json
{
  "deliveryId": 42,
  "eventId": "test-11111111-2222-4333-8444-555555555555",
  "type": "gateway.test",
  "status": "sent",
  "attempts": 1,
  "createdAt": "2026-10-01T12:00:00Z",
  "lastUpdatedAt": "2026-10-01T12:01:00Z",
  "sentAt": "2026-10-01T12:01:00Z",
  "nextAttemptAt": null,
  "outcome": null,
  "replayedBy": null
}
```

### 401

No token, or a token that is expired or not for this route: sign in again.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 403

Your identity is not allowed this route, or has no business wallet.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 409

Register a webhook before requesting a test.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 422

The request does not match this contract: `VALIDATION_ERROR` lists each field and the rule it broke. An amount outside $0.50 to $1,000,000 is refused here too.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 429

Over a limit. Wait and retry.

[Error](https://cadmospay.com/developers/schemas/error.md)
