Skip to content

create_routing_rule

POST
/api/v1/routing-rules
curl --request POST \
--url https://example.com/api/v1/routing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "channel_ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "group_ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "hold": true, "join": "or", "name": "example", "severity": "example", "tag_match": "any", "tags": [ "example" ], "when": { "days": [ 1 ], "end_minute": 1, "mode": "always", "start_minute": 1 }, "when_closed": "next_rule" }'
Media typeapplication/json

Create-rule body: a name, an optional severity filter (absent = any), the folders and tags a node must be inside or carry one of (ADR-259, ADR-262), and target channels. Editing a rule takes the same body (ADR-193).

object
channel_ids
required
Array<string>
group_ids

Only alerts on a node inside one of these folders, at any depth, reach the rule’s channels (ADR-262). Both this and tags empty = every node. Omitted on an edit, the rule keeps the folders it has.

Array<string> | null
hold

The rule sends nowhere: while it is the first open rule that matches an alert, the alert is held until another rule decides (ADR-262). channel_ids is then not read. Omitted on a create = false; omitted on an edit, the rule keeps its own.

boolean | null
join
One of:
null
name
required
string
severity

The lowest severity the rule takes: unreachable, critical, warning or info; it takes that one and every one above it (ADR-277). Absent or null = every alert. info also takes every alert, so it is stored as null and read back as null.

string | null
tag_match
One of:
null
tags

Only alerts on a node carrying at least one of these (or every one, by tag_match) among its effective labels (its own plus its folders’, minus the ones it refuses) reach the rule’s channels. Empty = every node. Compared exactly, case included. Omitted on an edit, the rule keeps the tags it has — a client that predates the field must not widen a rule by saving it.

Array<string> | null
when
One of:
null
when_closed
One of:
null

Rule created

Media typeapplication/json

The id of a freshly created resource — the whole body of a 201.

Deliberately one shape for every creator. The json!({"id": …}) literal it replaces was written out per handler, which is how {"id": …} and {"node_id": …} both ended up in this API for the same idea; a client then needs to know which creator it called to read the id back.

object
id
required
string format: uuid
Examplegenerated
{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Empty name, a severity outside unreachable|critical|warning|info|null, a tag that is empty, too long or holds a control character, or a when window with no weekday in 1..7 or a minute outside 0..1439

Media typeapplication/json

The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies undescribed — a client that has to guess the failure shape ends up parsing the success shape and reading undefined.

object
error
required
object
code
required

Stable machine-readable code. Clients branch on this, never on the message.

string
message
required

Operator-facing sentence. Safe to display; never carries an internal error’s own text.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example"
}
}

No valid bearer token

Media typeapplication/json

The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies undescribed — a client that has to guess the failure shape ends up parsing the success shape and reading undefined.

object
error
required
object
code
required

Stable machine-readable code. Clients branch on this, never on the message.

string
message
required

Operator-facing sentence. Safe to display; never carries an internal error’s own text.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example"
}
}

Role lacks ManageSystem

Media typeapplication/json

The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies undescribed — a client that has to guess the failure shape ends up parsing the success shape and reading undefined.

object
error
required
object
code
required

Stable machine-readable code. Clients branch on this, never on the message.

string
message
required

Operator-facing sentence. Safe to display; never carries an internal error’s own text.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example"
}
}

This core has no write side (skeleton mode)

Media typeapplication/json

The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies undescribed — a client that has to guess the failure shape ends up parsing the success shape and reading undefined.

object
error
required
object
code
required

Stable machine-readable code. Clients branch on this, never on the message.

string
message
required

Operator-facing sentence. Safe to display; never carries an internal error’s own text.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example"
}
}