const url = 'https://app.monitorly.cloud/api/v1/escalation-policies/POLICY_ID';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"levels":[{"delayMins":1,"targets":[{"id":"ID","kind":"channel"}]}],"name":"example","repeatAfterMins":1,"repeatCount":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://app.monitorly.cloud/api/v1/escalation-policies/POLICY_ID \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "levels": [ { "delayMins": 1, "targets": [ { "id": "ID", "kind": "channel" } ] } ], "name": "example", "repeatAfterMins": 1, "repeatCount": 1 }'Replaces the policy’s name, repeats and levels. Incidents already open keep the policy they started with. Workspace owner or admin.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The escalation policy’s id.
Example
POLICY_IDRequest Bodyrequired
Section titled “Request Bodyrequired”A policy as created or replaced.
object
1–10 levels in order.
object
Minutes after the level before; 0 for level 1, 1–1440 for the others.
At most 20, each once.
object
Example
IDWhat a target is.
1–100 characters; names need not be unique.
Minutes from the last level to the repeat, 1–10080.
How many times the whole policy runs again after its last level, 0–9.
Responses
Section titled “Responses”The policy.
object
Checks that use it instead of their project’s policy.
object
Targets that still exist: a removed channel, an unlinked chat or a member who left drops out.
object
What a target is.
The channel’s name, the chat’s title or the member’s display name.
Projects that use the policy by default (those the caller sees).
object
Example
{ "id": "ID", "levels": [ { "targets": [ { "id": "ID", "kind": "channel" } ] } ], "projects": [ { "id": "ID" } ], "workspaceId": "WORKSPACE_ID"}Bad Request.
request.malformed: the body or a parameter is not of the expected shapeauth.credentials_conflict: the request carries both a session cookie and a token
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Unauthorized.
auth.unauthenticated,auth.session_expired: no session, or it endedtoken.invalid: the token is malformed, unknown, revoked or expired, or its creator left the workspace
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Forbidden.
auth.forbidden: your role is too low for thistoken.scope_missing: the token lacks the scope this needs;detailnames itrequest.origin_mismatch,request.header_required: a changing request with a session comes from another site or lacksX-Monitorly-Request: 1
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Not Found.
request.not_found: it does not exist, or you cannot see it
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Payload Too Large.
request.too_large: the body is larger than 256 KiB
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Unprocessable Entity.
field.required,field.too_long,field.invalid: a field breaks a rule;errorspoints at itescalation_policy.no_levels: a policy has at least one levelescalation_policy.too_many_levels: more than 10 levels;params.maxescalation_policy.first_delay_not_zero: level 1 goes out when the incident opens: itsdelayMinsis 0escalation_policy.delay_out_of_range: a later level waits 1 to 1440 minutes after the one before;params.min,params.maxescalation_policy.too_many_targets: more than 20 targets on a level;params.maxescalation_policy.duplicate_target: the same target twice on one levelescalation_policy.target_unknown: the target is not an alert channel, a linked Telegram chat or a member of this workspaceescalation_policy.repeat_count_out_of_range:repeatCountis more than 9escalation_policy.repeat_after_out_of_range:repeatAfterMinsis not 1 to 10080;params.min,params.max
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Too Many Requests.
token.rate_limited: more than 10 requests a second with this tokensession.rate_limited: more than 5 changes a second from your sessions
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Headers
Section titled “Headers”Seconds to wait before trying again.