Documentation · API reference
POST
/api/v1/channelsAdd a channel
This page as Markdown, or in an AI chatMore ways to read this page
Add a channel for alerts.
# Add a channel
> tidekeeper's API reference: https://tidekeeper.eu/docs/api/post-channels
`POST /api/v1/channels`
Add a channel for alerts.
## What to send
`ChannelCreate`
- `config` (object, needed): The kind's own settings: `{"to": ["me@example.org"]}` for email, `{"url": "…", "secret": "…"}` for a webhook, `{"topic": "…"}` for ntfy.
- `kind` (string, needed)
- `kinds` (list of string or null): Left out, the kinds a new channel is told about by default.
- `name` (string, needed)
## The answer
201, `ChannelView`: Somewhere alerts go. Its secrets are never sent back: `target` says where it points with them left out.
- `created_at` (string, needed)
- `declared` (boolean, needed): From the instance's configuration: not edited here.
- `disabled` (boolean, needed)
- `id` (string, needed)
- `kind` (string, needed): `alertmanager`, `email`, `webhook`, `ntfy`, `discord`, `slack`, `telegram`.
- `kinds` (list of string, needed): The alerts this channel is told about: its row of the matrix.
- `name` (string, needed)
- `target` (string, needed)
## Asking
```sh
curl -X POST https://tidekeeper.eu/api/v1/channels \
-H "Authorization: Bearer $TIDEKEEPER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"config": {}, "kind": "…", "name": "…"}'
```
What to send
ChannelCreate
- config
- objectneededThe kind's own settings: `{"to": ["me@example.org"]}` for email, `{"url": "…", "secret": "…"}` for a webhook, `{"topic": "…"}` for ntfy.
- kind
- stringneeded
- kinds
- list of string or nullLeft out, the kinds a new channel is told about by default.
- name
- stringneeded
The answer
Status 201
ChannelView Somewhere alerts go. Its secrets are never sent back: `target` says where it points with them left out.
- created_at
- stringneeded
- declared
- booleanneededFrom the instance's configuration: not edited here.
- disabled
- booleanneeded
- id
- stringneeded
- kind
- stringneeded`alertmanager`, `email`, `webhook`, `ntfy`, `discord`, `slack`, `telegram`.
- kinds
- list of stringneededThe alerts this channel is told about: its row of the matrix.
- name
- stringneeded
- target
- stringneeded
Asking
curl -X POST https://tidekeeper.eu/api/v1/channels \ -H "Authorization: Bearer $TIDEKEEPER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"config": {}, "kind": "…", "name": "…"}'
const answer = await fetch("https://tidekeeper.eu/api/v1/channels", { method: "POST", headers: { Authorization: `Bearer ${process.env.TIDEKEEPER_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({"config": {}, "kind": "…", "name": "…"}), }).then((r) => r.json());