Skip to content

Post an alert to an automation

POST/api/alerts/{id}

Polaris' JSON, with the alert address's secret as a bearer token. The automation whose trigger owns the address runs. ntfy's JSON publish is also taken here, with the secret as its topic field. Unknown fields are refused.

Needs an API key in the Authorization header.

On this page

Parameters

FieldInTypeDescription
idrequiredpathstring
The alert address's id.
  • format: uuid

Request body

FieldTypeDescription
messagestring
  • max length: 16384
titlestring
  • max length: 250
severitynumber | string
prioritynumber | string
tagsstring | string[]
clickstring
  • max length: 2048
iconstring
  • max length: 2048
attachstring
  • max length: 2048
markdownboolean
actionsstring | object[]
dedupKeystring
  • max length: 200
JSON schema
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "maxLength": 16384
    },
    "title": {
      "type": "string",
      "maxLength": 250
    },
    "severity": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "maxLength": 10
        }
      ]
    },
    "priority": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "maxLength": 10
        }
      ]
    },
    "tags": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 510
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 50
          }
        }
      ]
    },
    "click": {
      "type": "string",
      "maxLength": 2048
    },
    "icon": {
      "type": "string",
      "maxLength": 2048
    },
    "attach": {
      "type": "string",
      "maxLength": 2048
    },
    "markdown": {
      "type": "boolean"
    },
    "actions": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 6384
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "maxLength": 20
              },
              "label": {
                "type": "string",
                "maxLength": 60
              },
              "url": {
                "type": "string",
                "maxLength": 2048
              },
              "clear": {
                "type": "boolean"
              },
              "method": {
                "type": "string",
                "maxLength": 10
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 500
                }
              },
              "body": {
                "type": "string",
                "maxLength": 4096
              },
              "intent": {
                "type": "string",
                "maxLength": 200
              },
              "extras": {
                "type": "object",
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            },
            "required": [
              "action",
              "label"
            ],
            "additionalProperties": false
          }
        }
      ]
    },
    "dedupKey": {
      "type": "string",
      "maxLength": 200
    }
  },
  "additionalProperties": false
}

Example request

curl -X POST "https://polaris.example.com/api/alerts/{id}" \
  -H "Authorization: Bearer $POLARIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "string",
  "title": "string",
  "severity": 0,
  "priority": 0,
  "tags": "string",
  "click": "string",
  "icon": "string",
  "attach": "string",
  "markdown": false,
  "actions": "string",
  "dedupKey": "string"
}'

Responses

StatusMeaning
200OK

Can also answer the common errors 400, 401, 403, 404, 429. See common errors