Developer API
Alerting via API

Alerting via API

Manage alerting for your Logs and Infrastructure Metrics stacks via the Logit.io Developer API. This guide covers enabling alerting, listing and creating alert rules, and configuring AlertManager (Metrics).

For an overview of alerting concepts, see Log Management Alerting and Infrastructure Metrics Alerting.

Use your Dashboard API key from the Profile (opens in a new tab) page in the x-api-key header. See Authentication for setup and security. Use @logs_id for Log stacks and @metrics_id for Metrics stacks (from your session/JWT when signed in).

Enable or Disable Alerting

For a stack with alerting available:

Enable alerting

Provisions the alerting server for the stack.

curl -X POST -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/enable

Disable alerting

Decommissions the alerting server for the stack.

curl -X POST -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/disable

Get alerting status

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/status

Log Management Alert Rules

List Alert Rules

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules

Returns rule IDs and file names.

Create an Alert Rule

curl -X POST -H "x-api-key: @dashboardApiKey" -H "Content-Type: application/json" \
  -d '{"newFileName": "my-alert.yaml", "templateFileName": "frequency"}' \
  https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules

Use templateFileName to start from an existing template, or omit it. The response includes the new rule ID.

Get rule configuration

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID

Get rule status

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID/status

Test a rule

curl -X POST -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID/test

Delete a rule

curl -X DELETE -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID

Get Alert Rule Templates

List available template file names for creating new rules:

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/alert-rule-templates

Infrastructure Metrics (AlertManager and Metrics Rules)

For Metrics stacks, you can manage AlertManager configuration and metrics alert rules (Prometheus-style YAML). Use @metrics_id for your Metrics stack.

AlertManager Configuration

Get AlertManager config

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@metrics_id/alerting/alert-manager

Save AlertManager config

Send configYaml and optional templateContent in the request body. To test before applying: POST to test, poll test-results/TEST_RUN_ID, then PUT to /alert-manager/apply/TEST_RUN_ID when status is Success.

curl -X PUT -H "x-api-key: @dashboardApiKey" -H "Content-Type: application/json" \
  -d '{"configYaml": "global:\n  resolve_timeout: 5m\nroute:\n  receiver: default", "templateContent": null}' \
  https://dashboard.logit.io/api/stacks/@metrics_id/alerting/alert-manager

Metrics Alert Rules

List metrics rules

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@metrics_id/alerting/metrics-rules

Get a metrics rule by file name

Replace alerts.yml with the rule file name.

curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@metrics_id/alerting/metrics-rules/alerts.yml

Update a metrics rule

PUT with rulesYaml in the body. Workflow: save (PUT) → test (POST) → poll test-results → apply (PUT /apply/TEST_RUN_ID) when status is Success.

curl -X PUT -H "x-api-key: @dashboardApiKey" -H "Content-Type: application/json" \
  -d '{"rulesYaml": "groups:\n- name: example\n  rules:\n  - alert: HighErrorRate"}' \
  https://dashboard.logit.io/api/stacks/@metrics_id/alerting/metrics-rules/alerts.yml

Full API Reference

See the API Reference for all alerting endpoints, request bodies, and response schemas.