Miru

Monitors

Create a new Monitor

Use the API to create a new monitor in your workspace.

Required Permissions

  • monitors.create

Example Request

This request will create a new monitor called Website that requests https://tygr.dev every 5 minutes and expects a 200 OK. URLs are used exactly as given. If you leave the scheme off, https:// is added for you.

http monitors require a config describing the request to send and the criteria that decide whether it passed. tcp monitors take no config, since connecting is the whole check.

curl -X POST "https://status.example.com/api/v1/monitor" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Website",
  "type": "http",
  "url": "https://tygr.dev",
  "interval": 5,
  "timeout": 30000,
  "config": {
    "method": "GET",
    "assertions": {
      "groups": [
        { "rules": [{ "source": "status", "operator": "equals", "value": "200" }] }
      ]
    }
  }
}'

A fuller example

Each group has a match of all or any, deciding how its rules combine. It defaults to all when omitted. Groups themselves are always combined with OR, so the monitor passes when any one group passes.

curl -X POST "https://status.example.com/api/v1/monitor" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "API",
  "type": "http",
  "url": "https://api.example.com/health",
  "interval": 1,
  "timeout": 5000,
  "config": {
    "method": "POST",
    "params": [{ "key": "verbose", "value": "1", "enabled": true, "secret": false }],
    "headers": [{ "key": "accept", "value": "application/json", "enabled": true, "secret": false }],
    "auth": { "type": "bearer", "token": "YOUR_TOKEN" },
    "body": { "type": "json", "content": "{\"probe\":true}" },
    "followRedirects": true,
    "assertions": {
      "groups": [
        { "match": "all", "rules": [
          { "source": "status", "operator": "equals", "value": "200" },
          { "source": "json", "key": "data.ok", "operator": "equals", "value": "true" },
          { "source": "responseTime", "operator": "lessThan", "value": "2000" }
        ] },
        { "match": "all", "rules": [
          { "source": "status", "operator": "equals", "value": "503" },
          { "source": "body", "operator": "contains", "value": "maintenance" }
        ] }
      ]
    }
  }
}'

Criteria

source is one of status, responseTime, body, header or json. header and json also take a key, either a header name or a dot-notation path such as data.status or items.0.id.

operator is one of equals, notEquals, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, contains, notContains, matches, isEmpty, exists or notExists. Not every operator applies to every source. Numeric comparisons are rejected on body, for example, and the API returns a 400 naming the offending rule.

Response

If the API key is valid, hasn't expired, and has the monitors.create permission, the API will return a JSON response with the details of the created monitor.

{
	"error": false,
	"monitor": {
		"id": "pAbfD8udMmgzPdXx",
		"workspaceId": "CiRW68WMhJUnlyeF",
		"name": "Website",
		"type": "http",
		"url": "https://tygr.dev",
		"interval": 5,
		"timeout": 30000,
		"createdAt": "2025-05-17T22:35:28.804Z",
		"updatedAt": "2025-05-17T22:35:28.804Z"
	}
}

The request configuration is stored separately and is never returned, since it can hold credentials.

Error Response

If there is a problem with the request, the API will return a JSON response with an error message.

{
	"error": true,
	"message": "Missing monitors permissions: create"
}

Types

The API will return a JSON response that can include the following values:

Response

Prop

Type

Monitor

Prop

Type

On this page