Skip to content

Update an alert rule

PATCH
/v1/alerts/rules/{id}
curl --request PATCH \
--url https://api.hooks.events/v1/alerts/rules/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "type": "failure_rate", "targetType": "project", "targetId": "example", "threshold": 1, "windowSeconds": 1, "cooldownSeconds": 1, "channels": [ { "type": "email", "to": "" } ], "enabled": true }'

Requires the alerts:write scope.

id
required
string
Media typeapplication/json
object
name
string
>= 1 characters <= 80 characters
type
string
Allowed values: failure_rate consecutive_failures dead_letter_count circuit_breaker signature_failure_spike rate_limit_spike
targetType
string
Allowed values: project endpoint destination
targetId
Any of:
string
>= 1 characters <= 100 characters
threshold
integer
>= 1 <= 1000000
windowSeconds
integer
>= 60 <= 604800
cooldownSeconds
integer
>= 60 <= 86400
channels
Array
>= 1 items <= 5 items
One of:
object
type
required
string
Allowed value: email
to
Any of:
string format: email
/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/
enabled
boolean

Success

Media typeapplication/json
object
ok
required
boolean
key
additional properties

Example generated

{
"ok": true
}

Validation error

Media typeapplication/json
object
error
required
object
code
required

Machine-readable error code

string
message
required
string
requestId
required

Request id, also echoed in x-request-id

string
key
additional properties

Example generated

{
"error": {
"code": "example",
"message": "example",
"requestId": "example"
}
}

Missing or invalid credentials

Media typeapplication/json
object
error
required
object
code
required

Machine-readable error code

string
message
required
string
requestId
required

Request id, also echoed in x-request-id

string
key
additional properties

Example generated

{
"error": {
"code": "example",
"message": "example",
"requestId": "example"
}
}

The credential lacks the required scope, or the workspace is not writable

Media typeapplication/json
object
error
required
object
code
required

Machine-readable error code

string
message
required
string
requestId
required

Request id, also echoed in x-request-id

string
key
additional properties

Example generated

{
"error": {
"code": "example",
"message": "example",
"requestId": "example"
}
}

Resource not found

Media typeapplication/json
object
error
required
object
code
required

Machine-readable error code

string
message
required
string
requestId
required

Request id, also echoed in x-request-id

string
key
additional properties

Example generated

{
"error": {
"code": "example",
"message": "example",
"requestId": "example"
}
}

Rate limited

Media typeapplication/json
object
error
required
object
code
required

Machine-readable error code

string
message
required
string
requestId
required

Request id, also echoed in x-request-id

string
key
additional properties

Example generated

{
"error": {
"code": "example",
"message": "example",
"requestId": "example"
}
}
X-RateLimit-Limit
integer

Requests allowed per window

X-RateLimit-Remaining
integer
X-RateLimit-Reset
integer

Seconds until the window resets