Documentation Index
Fetch the complete documentation index at: https://docs.selftune.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Alerts API lets you create alerts that notify you when your skills meet specific performance conditions. Alerts are sent to Slack, Discord, email, or custom webhooks.
Alert types
Alerts monitor two key metrics:
| Type | Metric | Threshold Range | Description |
|---|
pass_rate_below | Pass rate | 0–1 | Alert when skill pass rate drops below a threshold (e.g., 0.8 = 80%) |
no_data | Days without sessions | 0–90 | Alert when a skill hasn’t recorded sessions for N days |
Create alert
Creates a new alert for a skill or across all skills.
POST /api/v1/alerts
Content-Type: application/json
Authorization: Bearer {API_KEY}
{
"skill_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "pass_rate_below",
"threshold": 0.75,
"channel": "slack",
"config": {
"slack_webhook_url": "https://hooks.slack.com/services/..."
}
}
Request fields
| Field | Type | Required | Notes |
|---|
skill_id | UUID string | No | Omit to create an alert for all skills |
type | pass_rate_below | no_data | Yes | The condition to monitor |
threshold | Number | No | Constraint depends on alert type (see below) |
channel | slack | discord | email | webhook | Yes | Where to send notifications |
config | Object | Yes | Channel-specific configuration |
Threshold constraints
For pass_rate_below alerts:
- Must be between 0 and 1 (as a decimal)
- Example:
0.75 = alert when pass rate drops below 75%
- Invalid example:
75 (must be 0.75, not 75)
For no_data alerts:
- Must be between 0 and 90 (days)
- Example:
7 = alert if no sessions recorded for 7 days
- Invalid example:
100 (maximum is 90 days)
Channel configuration
Slack:
{
"slack_webhook_url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
}
Discord:
{
"discord_webhook_url": "https://discordapp.com/api/webhooks/YOUR/WEBHOOK"
}
Email:
Custom webhook:
{
"webhook_url": "https://your-api.com/alerts"
}
Response
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"skill_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "pass_rate_below",
"threshold": 0.75,
"channel": "slack",
"created_at": "2026-04-08T12:34:56Z"
}
Validation errors
If your threshold is invalid for the alert type, you’ll receive:
Example: pass_rate_below with threshold > 1
{
"error": "Validation failed",
"details": {
"path": ["threshold"],
"message": "pass_rate_below threshold must be between 0 and 1"
}
}
Example: no_data with threshold > 90
{
"error": "Validation failed",
"details": {
"path": ["threshold"],
"message": "no_data threshold must be between 0 and 90 days"
}
}
Examples
Alert when pass rate drops below 80%
curl -X POST https://api.selftune.dev/api/v1/alerts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"skill_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "pass_rate_below",
"threshold": 0.8,
"channel": "slack",
"config": {
"slack_webhook_url": "https://hooks.slack.com/services/..."
}
}'
Alert if skill has no data for 7 days
curl -X POST https://api.selftune.dev/api/v1/alerts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"skill_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "no_data",
"threshold": 7,
"channel": "email",
"config": {
"email": "[email protected]"
}
}'
Alert across all skills
Omit skill_id to apply the alert to all skills:
curl -X POST https://api.selftune.dev/api/v1/alerts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "pass_rate_below",
"threshold": 0.7,
"channel": "slack",
"config": {
"slack_webhook_url": "https://hooks.slack.com/services/..."
}
}'