Skip to content

API reference

Monitors as code

Monitors as code endpoints of the StatusTick REST API: plan a monitors file sync, sync a monitors file, with parameters, responses and examples.

POST/v1/monitors/managed/plan

What PUT /v1/monitors/managed would create, change, take over (ADOPT) and delete for this file, field by field; changes nothing, so a READ key is enough. The statustick CLI (statustick sync --dry-run) calls it. An entry with an id of a monitor made by hand is planned as ADOPT even without adopt.

Authorization

apiKey
AuthorizationBearer <token>

Your organization's API key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/monitors/managed/plan" \  -H "Content-Type: application/json" \  -d '{    "monitors": [      {        "key": "string",        "type": "HTTP"      }    ]  }'
{  "dryRun": true,  "changes": [    {      "action": "CREATE",      "key": "checkout",      "monitorId": null,      "name": "Checkout",      "fields": [        {          "field": "name",          "from": null,          "to": "Checkout"        },        {          "field": "target",          "from": null,          "to": "https://shop.example.com/checkout"        }      ]    },    {      "action": "UPDATE",      "key": "api",      "monitorId": "mnt_4KrVK3M1DqhDTFouCffKie",      "name": "API",      "fields": [        {          "field": "intervalSeconds",          "from": 300,          "to": 60        },        {          "field": "headers.Authorization",          "from": "********",          "to": "********"        }      ]    },    {      "action": "DELETE",      "key": "legacy",      "monitorId": "mnt_1y5GOXhpbdZtj5E6q3xVVP",      "name": "Legacy",      "fields": []    }  ],  "monitors": [    {      "key": "api",      "monitorId": "mnt_4KrVK3M1DqhDTFouCffKie",      "name": "API",      "type": "HTTP",      "pingURL": null    }  ]}

Sync a monitors file

PUT/v1/monitors/managed

Needs a READ_WRITE key. Makes the monitors a monitors file manages (managedBy: FILE, managedKey = the entry's key) match monitors: creates new keys, changes what differs and deletes FILE monitors whose key is gone (unless prune is false). Monitors made in the dashboard are never touched, except an entry naming one by id with adopt: true, which takes it over. Every monitor is saved, or none. FILE monitors refuse hand edits other than alert settings, mute and delete (monitor.managed_by_file.unprocessable). One sync per organization at a time (monitors.sync_busy.unprocessable while another runs). Left-out fields take the defaults of a new monitor, except locations, which keep the monitor's locations. Alert policies and status page components are set with PUT /v1/alert-policies/{policyId}/monitors and PUT /v1/status-pages/monitors/{monitorId}/components.

Authorization

apiKey
AuthorizationBearer <token>

Your organization's API key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/monitors/managed" \  -H "Content-Type: application/json" \  -d '{    "monitors": [      {        "key": "api",        "name": "API",        "type": "HTTP",        "target": "https://api.example.com/health",        "intervalSeconds": 60,        "locations": [          "us-east",          "eu-west"        ],        "expectedStatusCodes": [          200        ],        "tags": [          "prod"        ]      }    ]  }'
{  "dryRun": true,  "changes": [    {      "action": "CREATE",      "key": "string",      "monitorId": "string",      "name": "string",      "fields": [        {          "field": "string",          "from": null,          "to": null        }      ]    }  ],  "monitors": [    {      "key": "string",      "monitorId": "string",      "name": "string",      "type": "HTTP",      "pingURL": "string"    }  ]}
All docs