POST
/
alerts
/
update
curl --request POST \
  --url https://us-east.metoro.io/api/v1/alerts/update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "alert": {
    "metadata": {
      "name": "name",
      "description": "description",
      "id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "timeseries": {
      "expression": {
        "metoroQLTimeseries": {
          "query": "count(traces)",
          "bucketSize": 60
        }
      },
      "evaluationRules": [
        {
          "static": {
            "persistenceSettings": {
              "datapointsToAlarm": 3,
              "missingDatapointBehavior": "notBreaching",
              "datapointsInEvaluationWindow": 5
            },
            "operators": [
              {
                "threshold": 5000,
                "operator": "greaterThan"
              }
            ]
          },
          "name": "name",
          "type": "static",
          "actions": [
            {
              "slackDestination": {
                "channel": "my-alerts-channel"
              },
              "type": "slack"
            },
            {
              "emailDestination": {
                "emails": [
                  "user@example.com",
                  "admin@example.com"
                ]
              },
              "type": "email"
            }
          ]
        }
      ]
    },
    "type": "timeseries"
  }
}'
{
  "id": "123e4567-e89b-12d3-a456-426614174000"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
Alert to create or update

Request to create a new alert or update an existing one. If alert.metadata.id is provided and matches an existing alert, that alert will be updated.

alert
object
required
Example:
{
  "metadata": {
    "name": "name",
    "description": "description",
    "id": "123e4567-e89b-12d3-a456-426614174000"
  },
  "timeseries": {
    "expression": {
      "metoroQLTimeseries": {
        "query": "count(traces)",
        "bucketSize": 60
      }
    },
    "evaluationRules": [
      {
        "static": {
          "persistenceSettings": {
            "datapointsToAlarm": 3,
            "missingDatapointBehavior": "notBreaching",
            "datapointsInEvaluationWindow": 5
          },
          "operators": [
            {
              "threshold": 5000,
              "operator": "greaterThan"
            }
          ]
        },
        "name": "name",
        "type": "static",
        "actions": [
          {
            "slackDestination": { "channel": "my-alerts-channel" },
            "type": "slack"
          },
          {
            "emailDestination": {
              "emails": ["user@example.com", "admin@example.com"]
            },
            "type": "email"
          }
        ]
      }
    ]
  },
  "type": "timeseries"
}

Response

200
application/json
Alert created or updated successfully
id
string
required

Unique identifier for the created or updated alert