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/enableDisable 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/disableGet alerting status
curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/statusLog Management Alert Rules
List Alert Rules
curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rulesReturns 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/rulesUse 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_IDGet rule status
curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID/statusTest a rule
curl -X POST -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_ID/testDelete a rule
curl -X DELETE -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@logs_id/alerting/rules/RULE_IDGet 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-templatesInfrastructure 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-managerSave 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-managerMetrics Alert Rules
List metrics rules
curl -H "x-api-key: @dashboardApiKey" https://dashboard.logit.io/api/stacks/@metrics_id/alerting/metrics-rulesGet 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.ymlUpdate 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.ymlFull API Reference
See the API Reference for all alerting endpoints, request bodies, and response schemas.