Sign Up
Home Getting Started SDK Guides AI Product Guide API Reference
Open in ChatGPT Open in Claude Open in Perplexity

POST /api/v1/monitors

POST/api/v1/monitors

Authenticate with Authorization: Bearer YOUR_API_KEY and X-Project-Id: YOUR_PROJECT_ID. Replace path placeholders and example values with your project's values.

Parameters

NameLocationTypePresenceDescription
X-Project-Idheaderstring (uuid)RequiredProject UUID. Use the project associated with your API key.

Request Body

Create request.json with the fields this operation requires. The examples read that file.

JSON schema
{
  "oneOf": [
    {
      "properties": {
        "active": {
          "type": "boolean"
        },
        "alert_recovery_threshold": {
          "format": "double",
          "type": "number"
        },
        "alert_threshold": {
          "format": "double",
          "type": "number"
        },
        "check_interval_mins": {
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000,
          "type": "integer"
        },
        "email_all": {
          "type": "boolean"
        },
        "emails": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "environment": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "notify_after_mins": {
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000,
          "type": "integer"
        },
        "query": {
          "type": "string"
        },
        "service": {
          "type": "string"
        },
        "severity": {
          "type": "string"
        },
        "slack_channels": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "stop_after_count": {
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000,
          "type": "integer"
        },
        "subject": {
          "type": "string"
        },
        "teams": {
          "items": {
            "$ref": "#/components/schemas/UUID"
          },
          "type": "array"
        },
        "threshold_sustained_for_mins": {
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000,
          "type": "integer"
        },
        "time_window_mins": {
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000,
          "type": "integer"
        },
        "title": {
          "type": "string"
        },
        "trigger_less_than": {
          "type": "boolean"
        },
        "unit": {
          "type": "string"
        },
        "visualization_type": {
          "type": "string"
        },
        "warning_recovery_threshold": {
          "format": "double",
          "type": "number"
        },
        "warning_threshold": {
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "title",
        "query",
        "alert_threshold",
        "trigger_less_than",
        "check_interval_mins",
        "time_window_mins",
        "emails",
        "slack_channels",
        "teams"
      ],
      "type": "object"
    },
    {
      "$ref": "#/components/schemas/MonitorConfig"
    }
  ]
}

Examples

curl --request POST 'https://api.monoscope.tech/api/v1/monitors' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'X-Project-Id: YOUR_PROJECT_ID' \
  --header 'Content-Type: application/json' \
  --data-binary @request.json
import requests
import json

with open("request.json") as body_file:
  payload = json.load(body_file)

response = requests.post(
  "https://api.monoscope.tech/api/v1/monitors",
  headers={
  "Authorization": "Bearer YOUR_API_KEY",
  "X-Project-Id": "YOUR_PROJECT_ID",
  "Content-Type": "application/json"
},
  json=payload,
  timeout=30,
)
response.raise_for_status()
print(response.text)
import { readFile } from "node:fs/promises";
const payload = await readFile("request.json", "utf8");

const response = await fetch("https://api.monoscope.tech/api/v1/monitors", {
  method: "POST",
  headers: {
  "Authorization": "Bearer YOUR_API_KEY",
  "X-Project-Id": "YOUR_PROJECT_ID",
  "Content-Type": "application/json"
},
  body: payload,
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());

Responses

HTTP 200

Response defined by the API schema.

FieldTypePresenceDescription
alert_configobjectRequired
alert_last_triggeredstring (yyyy-mm-ddThh:MM:ssZ)Optional
alert_recovery_thresholdnumber (double)Optional
alert_thresholdnumber (double)Required
check_interval_minsintegerRequired
created_atstring (yyyy-mm-ddThh:MM:ssZ)Required
current_statusnormal | warning | alertingRequired
current_valuenumber (double)Required
dashboard_idstring (uuid)Optional
deactivated_atstring (yyyy-mm-ddThh:MM:ssZ)Optional
deleted_atstring (yyyy-mm-ddThh:MM:ssZ)Optional
environmentstringOptional
idstring (uuid)Required
last_evaluatedstring (yyyy-mm-ddThh:MM:ssZ)Optional
log_querystringRequired
log_query_as_sqlstringRequired
muted_untilstring (yyyy-mm-ddThh:MM:ssZ)Optional
notification_countintegerRequired
project_idstring (uuid)Required
renotify_interval_minsintegerOptional
servicestringOptional
stop_after_countintegerOptional
teamsstring (uuid)[]Required
threshold_sustained_for_minsintegerRequired
time_window_minsintegerRequired
trigger_less_thanbooleanRequired
updated_atstring (yyyy-mm-ddThh:MM:ssZ)Required
visualization_typestringRequired
warning_last_triggeredstring (yyyy-mm-ddThh:MM:ssZ)Optional
warning_recovery_thresholdnumber (double)Optional
warning_thresholdnumber (double)Optional
widget_idstringOptional
JSON schema
{
  "properties": {
    "alert_config": {
      "$ref": "#/components/schemas/MonitorAlertConfig"
    },
    "alert_last_triggered": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "alert_recovery_threshold": {
      "format": "double",
      "type": "number"
    },
    "alert_threshold": {
      "format": "double",
      "type": "number"
    },
    "check_interval_mins": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "created_at": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "current_status": {
      "enum": [
        "normal",
        "warning",
        "alerting"
      ],
      "type": "string"
    },
    "current_value": {
      "format": "double",
      "type": "number"
    },
    "dashboard_id": {
      "$ref": "#/components/schemas/UUID"
    },
    "deactivated_at": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "deleted_at": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "environment": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/UUID"
    },
    "last_evaluated": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "log_query": {
      "type": "string"
    },
    "log_query_as_sql": {
      "type": "string"
    },
    "muted_until": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "notification_count": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "project_id": {
      "$ref": "#/components/schemas/UUID"
    },
    "renotify_interval_mins": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "service": {
      "type": "string"
    },
    "stop_after_count": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "teams": {
      "items": {
        "$ref": "#/components/schemas/UUID"
      },
      "type": "array"
    },
    "threshold_sustained_for_mins": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "time_window_mins": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "trigger_less_than": {
      "type": "boolean"
    },
    "updated_at": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "visualization_type": {
      "type": "string"
    },
    "warning_last_triggered": {
      "$ref": "#/components/schemas/UTCTime"
    },
    "warning_recovery_threshold": {
      "format": "double",
      "type": "number"
    },
    "warning_threshold": {
      "format": "double",
      "type": "number"
    },
    "widget_id": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "project_id",
    "created_at",
    "updated_at",
    "check_interval_mins",
    "alert_threshold",
    "log_query",
    "log_query_as_sql",
    "trigger_less_than",
    "threshold_sustained_for_mins",
    "alert_config",
    "visualization_type",
    "teams",
    "current_status",
    "current_value",
    "notification_count",
    "time_window_mins"
  ],
  "type": "object"
}

HTTP 400

Refused; error.code says why

FieldTypePresenceDescription
errorobjectRequired
JSON schema
{
  "properties": {
    "error": {
      "$ref": "#/components/schemas/ApiProblem"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

HTTP 401

Refused; error.code says why

FieldTypePresenceDescription
errorobjectRequired
JSON schema
{
  "properties": {
    "error": {
      "$ref": "#/components/schemas/ApiProblem"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

Authentication · Errors and retries · OpenAPI specification