# Alarm channels

Alarm channels: the Slack, Microsoft Teams and webhook destinations alarms notify; their destinations are write-only.

Its operations need the scopes `channels.edit`, `channels.view` or `channels.delete`.

**Endpoints**

- `POST/v1/alarm-channels`
- `PUT/v1/alarm-channels/{channel_uuid}`
- `GET/v1/alarm-channels/{channel_uuid}`
- `GET/v1/alarm-channels`
- `DELETE/v1/alarm-channels/{channel_uuid}`
- `POST/v1/alarm-channels/{channel_uuid}/test`

## The Alarm channel object

### Attributes

- `uuid` (string): The channel’s uuid.
- `type` (string): The channel’s type: `slack`, `teams` or `webhook`.
- `name` (string): The channel’s display name.
- `active` (boolean): Whether the channel is switched on.
- `signing_secret_set` (boolean): Whether a webhook channel holds a signing secret; always false for the other types. The secret is never returned.
- `signing_secret_rotated_at` (integer or null): Epoch milliseconds. When the signing secret was last replaced; null if never. An instant: epoch milliseconds, UTC.
- `created_at` (integer or null): Epoch milliseconds. When the channel was created. An instant: epoch milliseconds, UTC.

**The Alarm channel object**

```json
{
  "uuid": "75666699-b77d-4631-b576-041e8102a55b",
  "type": "example",
  "name": "example",
  "active": true,
  "signing_secret_set": true,
  "signing_secret_rotated_at": 1794214800000,
  "created_at": 1794214800000
}
```

## Create an alarm channel

POST/v1/alarm-channels

Creates a Slack, Microsoft Teams or regular webhook channel from its destination URL. The URL is write-only: it is never returned. A webhook channel is given a signing secret, which is never returned either.

Needs the scope `channels.edit`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Body parameters

- `type` (string, required): The channel’s type: `slack`, `teams` or `webhook`. It cannot be changed afterwards. Values:`slack``teams``webhook`(an open set: new values may be added)
- `name` (string, required): The channel’s display name, up to 255 characters.
- `webhook_url` (string (uri), required): The destination: a public HTTPS URL (for Slack the incoming-webhook URL), up to 2048 characters. It is write-only: no answer returns it.
- `active` (boolean or null): Whether the channel is switched on; defaults to on.

### Returns

`201 Created`:

The created alarm channel.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**POST /v1/alarm-channels**

curl:

```bash
curl -X POST https://rest.watchtower15.com/v1/alarm-channels \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "type": "slack",
    "name": "example",
    "webhook_url": "https://example.com"
  }'
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$alarmChannel = $wt15->alarmChannels->create(['type' => 'slack', 'name' => 'example', 'webhook_url' => 'https://example.com']);
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.alarmChannels.create({ type: 'slack', name: 'example', webhook_url: 'https://example.com' });
```

Python:

```python
client = Client.from_environment()

result = client.alarm_channels.create(type='slack', name='example', webhook_url='https://example.com')
```

**Response (201 Created)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "type": "example",
    "name": "example",
    "active": true,
    "signing_secret_set": true,
    "signing_secret_rotated_at": 1794214800000,
    "created_at": 1794214800000
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Update an alarm channel

PUT/v1/alarm-channels/{channel\_uuid}

Changes the fields sent: the name, a new destination URL and whether the channel is switched on. The type cannot be changed. Switching a channel on re-checks its saved destination.

Needs the scope `channels.edit`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Path parameters

- `channel_uuid` (string (uuid), required): The uuid of the alarm channel in the path.

### Body parameters

- `name` (string or null): The channel’s display name, up to 255 characters.
- `webhook_url` (string (uri) or null): A new destination: a public HTTPS URL, up to 2048 characters. It is write-only: omit it to keep the saved one.
- `active` (boolean or null): Whether the channel is switched on. Switching a channel on re-checks its saved destination.

### Returns

`200 OK`:

The alarm channel after the update.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**PUT /v1/alarm-channels/{channel_uuid}**

curl:

```bash
curl -X PUT https://rest.watchtower15.com/v1/alarm-channels/d31a7beb-1e13-48a3-b251-a3205b80633c \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$alarmChannel = $wt15->alarmChannels->update('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.alarmChannels.update('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Python:

```python
client = Client.from_environment()

result = client.alarm_channels.update('d31a7beb-1e13-48a3-b251-a3205b80633c')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "type": "example",
    "name": "example",
    "active": true,
    "signing_secret_set": true,
    "signing_secret_rotated_at": 1794214800000,
    "created_at": 1794214800000
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Get an alarm channel

GET/v1/alarm-channels/{channel\_uuid}

Returns one alarm channel. The destination (the webhook URL) and the signing secret are never returned: only whether a signing secret is set.

Needs the scope `channels.view`.

### Path parameters

- `channel_uuid` (string (uuid), required): The uuid of the alarm channel in the path.

### Returns

`200 OK`:

The alarm channel.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**GET /v1/alarm-channels/{channel_uuid}**

curl:

```bash
curl https://rest.watchtower15.com/v1/alarm-channels/d31a7beb-1e13-48a3-b251-a3205b80633c \
  -H "Authorization: Bearer $WT15_API_KEY"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$alarmChannel = $wt15->alarmChannels->view('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.alarmChannels.view('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Python:

```python
client = Client.from_environment()

result = client.alarm_channels.view('d31a7beb-1e13-48a3-b251-a3205b80633c')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "type": "example",
    "name": "example",
    "active": true,
    "signing_secret_set": true,
    "signing_secret_rotated_at": 1794214800000,
    "created_at": 1794214800000
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.view scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid (`invalid_request`; `errors` names the parameters).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## List alarm channels

GET/v1/alarm-channels

Returns the organisation’s alarm channels. A channel’s destination and signing secret are never returned. Pages by `page` and `per_page` (`limit` is the same as `per_page`); every page carries `current_page`, `per_page`, `last_page` and `total`.

Needs the scope `channels.view`.

### Query parameters

- `limit` (integer or null): The same as `per_page`, kept for existing clients.
- `include_total` (string or null): Ignored: `total` is always present. Values:`true``false``1``0`(an open set: new values may be added)
- `per_page` (integer or null): The page size, from 1 to 100.
- `page` (integer or null): The page to read, from 1; 1 when omitted. A page past the last answers no rows.

### Returns

`200 OK`:

One page of the organisation’s alarm channels.

Each item of the page:

- `uuid` (string): The channel’s uuid.
- `type` (string): The channel’s type: `slack`, `teams` or `webhook`.
- `name` (string): The channel’s display name.
- `active` (boolean): Whether the channel is switched on.
- `signing_secret_set` (boolean): Whether a webhook channel holds a signing secret; always false for the other types. The secret is never returned.
- `created_at` (integer or null): Epoch milliseconds. When the channel was created. An instant: epoch milliseconds, UTC.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**GET /v1/alarm-channels**

curl:

```bash
curl https://rest.watchtower15.com/v1/alarm-channels \
  -H "Authorization: Bearer $WT15_API_KEY"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

foreach ($wt15->alarmChannels->list()->autoPaging() as $alarmChannel) { echo $alarmChannel->uuid, "\n"; }
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

for await (const item of wt15.alarmChannels.list()) {
  console.log(item.uuid);
}
```

Python:

```python
client = Client.from_environment()

for item in client.alarm_channels.list():
    print(item.uuid)
```

**Response (200 OK)**

```json
{
  "data": [
    {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "type": "example",
      "name": "example",
      "active": true,
      "signing_secret_set": true,
      "created_at": 1794214800000
    }
  ],
  "current_page": 1,
  "per_page": 1,
  "last_page": 1,
  "total": 1
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.view scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid (`invalid_request`; `errors` names the parameters).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Delete an alarm channel

DELETE/v1/alarm-channels/{channel\_uuid}

Deletes the channel. A channel an alarm policy still notifies is refused: remove it from the policy first. The answer has no body.

Needs the scope `channels.delete`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Path parameters

- `channel_uuid` (string (uuid), required): The uuid of the alarm channel in the path.

### Returns

`204 No Content`:

The alarm channel was deleted; there is no body.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**DELETE /v1/alarm-channels/{channel_uuid}**

curl:

```bash
curl -X DELETE https://rest.watchtower15.com/v1/alarm-channels/d31a7beb-1e13-48a3-b251-a3205b80633c \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$wt15->alarmChannels->delete('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

await wt15.alarmChannels.delete('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Python:

```python
client = Client.from_environment()

client.alarm_channels.delete('d31a7beb-1e13-48a3-b251-a3205b80633c')
```

**Response (204 No Content)**

```http
HTTP/1.1 204 No Content
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.delete scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Send a test message to an alarm channel

POST/v1/alarm-channels/{channel\_uuid}/test

Sends one test message to the channel’s saved destination. The call is refused when the saved destination is no longer allowed, and is limited to a few a minute.

Needs the scope `channels.edit`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Path parameters

- `channel_uuid` (string (uuid), required): The uuid of the alarm channel in the path.

### Returns

`200 OK`:

The test message was sent.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**POST /v1/alarm-channels/{channel_uuid}/test**

curl:

```bash
curl -X POST https://rest.watchtower15.com/v1/alarm-channels/d31a7beb-1e13-48a3-b251-a3205b80633c/test \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$result = $wt15->alarmChannels->sendTest('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.alarmChannels.sendTest('d31a7beb-1e13-48a3-b251-a3205b80633c');
```

Python:

```python
client = Client.from_environment()

result = client.alarm_channels.send_test('d31a7beb-1e13-48a3-b251-a3205b80633c')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "sent": true
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the channels.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

Source: https://developer.watchtower15.com/api/reference/alarm-channels/
