API reference
Alerts
Rules that notify you when a metric crosses a threshold.
List alerts
GET/api/alerts
Alert rules in scope, with their thresholds and where they notify.
Secret API key. How it works
Query parameters
project_idstringOnly this project's alerts.
Returns
200 OK
Response attributes
dataarray of Alertrequired12 attributes
idstringrequiredorg_idstringrequiredproject_idstringrequirednamestringrequiredmetricstringrequiredOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringrequiredOne of
gtgteltltethresholdstringrequiredDecimal serialized as a string (numeric column).
window_secondsstringrequiredInteger serialized as a string (numeric column).
channelAlertChannelrequired2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledbooleanrequiredcreated_atstringISO 8601 timestampupdated_atstringISO 8601 timestamp
- 401 Missing, malformed, unknown or revoked API key (
unauthorized) - 429 Rate limit exceeded (
rate_limited). WaitRetry-Afterseconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
curl "https://api.myleadsfactory.tech/api/alerts" \
-H "Authorization: Bearer $MLF_API_KEY"{
"data": [
{
"id": "id_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"org_id": "org_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"project_id": "proj_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"name": "Front desk",
"metric": "call_count",
"comparator": "gt",
"threshold": "string",
"window_seconds": "string",
"channel": {
"type": "slack",
"url": "https://example.com/hook"
},
"enabled": true,
"created_at": "2026-10-28T09:30:00.000Z",
"updated_at": "2026-10-28T09:30:00.000Z"
}
]
}Create an alert
POST/api/alerts
A rule that watches one call metric (count, total cost, average latency or error rate) over a rolling window and posts to a Slack incoming webhook or your HTTPS URL when it crosses the threshold, and again when it recovers. It does not repeat while it stays breached. An org-wide key must name project_id.
Secret API key, not read-only. How it works
Request body
project_idstringRequired for an org-wide key.
namestringrequirednot emptymetricstringrequiredOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringrequiredHow the metric compares with the threshold to fire.
One of
gtgteltltethresholdnumberrequiredwindow_secondsintegerrequiredmin 1The rolling window the metric is measured over.
channelAlertChannelrequired2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledbooleanDefault true.
Returns
201 OK
Response attributes
dataAlertrequired12 attributes
idstringrequiredorg_idstringrequiredproject_idstringrequirednamestringrequiredmetricstringrequiredOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringrequiredOne of
gtgteltltethresholdstringrequiredDecimal serialized as a string (numeric column).
window_secondsstringrequiredInteger serialized as a string (numeric column).
channelAlertChannelrequired2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledbooleanrequiredcreated_atstringISO 8601 timestampupdated_atstringISO 8601 timestamp
- 400 Validation error: usually
invalid_request, with the failing fields inissueswhen there are any - 401 Missing, malformed, unknown or revoked API key (
unauthorized) - 403 Refused, for example a read-only key on a write (
read_only_key), a role too low for the route (insufficient_role), or a route that needs a console session - 404 Not found, or outside what the key can see
- 429 Rate limit exceeded (
rate_limited). WaitRetry-Afterseconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
curl -X POST "https://api.myleadsfactory.tech/api/alerts" \
-H "Authorization: Bearer $MLF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Front desk",
"metric": "call_count",
"comparator": "gt",
"threshold": 1,
"window_seconds": 1,
"channel": {
"type": "slack",
"url": "https://example.com/hook"
}
}'{
"data": {
"id": "id_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"org_id": "org_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"project_id": "proj_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"name": "Front desk",
"metric": "call_count",
"comparator": "gt",
"threshold": "string",
"window_seconds": "string",
"channel": {
"type": "slack",
"url": "https://example.com/hook"
},
"enabled": true,
"created_at": "2026-10-28T09:30:00.000Z",
"updated_at": "2026-10-28T09:30:00.000Z"
}
}Get an alert
GET/api/alerts/{id}
One alert rule.
Secret API key. How it works
Path parameters
idstringrequiredAlert id.
Returns
200 OK
Response attributes
dataAlertrequired12 attributes
idstringrequiredorg_idstringrequiredproject_idstringrequirednamestringrequiredmetricstringrequiredOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringrequiredOne of
gtgteltltethresholdstringrequiredDecimal serialized as a string (numeric column).
window_secondsstringrequiredInteger serialized as a string (numeric column).
channelAlertChannelrequired2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledbooleanrequiredcreated_atstringISO 8601 timestampupdated_atstringISO 8601 timestamp
- 401 Missing, malformed, unknown or revoked API key (
unauthorized) - 404 Not found, or outside what the key can see
- 429 Rate limit exceeded (
rate_limited). WaitRetry-Afterseconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
curl "https://api.myleadsfactory.tech/api/alerts/ALERT_ID" \
-H "Authorization: Bearer $MLF_API_KEY"{
"data": {
"id": "id_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"org_id": "org_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"project_id": "proj_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"name": "Front desk",
"metric": "call_count",
"comparator": "gt",
"threshold": "string",
"window_seconds": "string",
"channel": {
"type": "slack",
"url": "https://example.com/hook"
},
"enabled": true,
"created_at": "2026-10-28T09:30:00.000Z",
"updated_at": "2026-10-28T09:30:00.000Z"
}
}Update an alert
PATCH/api/alerts/{id}
Change any field of the rule, or turn it off with enabled: false. Send at least one field.
Secret API key, not read-only. How it works
Path parameters
idstringrequiredAlert id.
Request body
namestringnot emptymetricstringOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringOne of
gtgteltltethresholdnumberwindow_secondsintegermin 1channelAlertChannel2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledboolean
Returns
200 OK
Response attributes
dataAlertrequired12 attributes
idstringrequiredorg_idstringrequiredproject_idstringrequirednamestringrequiredmetricstringrequiredOne of
call_countcost_totalavg_latency_mserror_ratecomparatorstringrequiredOne of
gtgteltltethresholdstringrequiredDecimal serialized as a string (numeric column).
window_secondsstringrequiredInteger serialized as a string (numeric column).
channelAlertChannelrequired2 attributes
typestringrequiredOne of
slackwebhookurlstringrequireduriPublic HTTPS destination. Private addresses and redirects are refused.
enabledbooleanrequiredcreated_atstringISO 8601 timestampupdated_atstringISO 8601 timestamp
- 400 Validation error: usually
invalid_request, with the failing fields inissueswhen there are any - 401 Missing, malformed, unknown or revoked API key (
unauthorized) - 403 Refused, for example a read-only key on a write (
read_only_key), a role too low for the route (insufficient_role), or a route that needs a console session - 404 Not found, or outside what the key can see
- 429 Rate limit exceeded (
rate_limited). WaitRetry-Afterseconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
curl -X PATCH "https://api.myleadsfactory.tech/api/alerts/ALERT_ID" \
-H "Authorization: Bearer $MLF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Front desk",
"metric": "call_count"
}'{
"data": {
"id": "id_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"org_id": "org_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"project_id": "proj_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"name": "Front desk",
"metric": "call_count",
"comparator": "gt",
"threshold": "string",
"window_seconds": "string",
"channel": {
"type": "slack",
"url": "https://example.com/hook"
},
"enabled": true,
"created_at": "2026-10-28T09:30:00.000Z",
"updated_at": "2026-10-28T09:30:00.000Z"
}
}Delete an alert
DELETE/api/alerts/{id}
Removes the rule; it stops notifying at once.
Secret API key, not read-only. How it works
Path parameters
idstringrequiredAlert id.
Returns
200 OK
Response attributes
dataDeleteResultrequired2 attributes
idstringrequireddeletedbooleanrequired
- 401 Missing, malformed, unknown or revoked API key (
unauthorized) - 403 Refused, for example a read-only key on a write (
read_only_key), a role too low for the route (insufficient_role), or a route that needs a console session - 404 Not found, or outside what the key can see
- 429 Rate limit exceeded (
rate_limited). WaitRetry-Afterseconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
curl -X DELETE "https://api.myleadsfactory.tech/api/alerts/ALERT_ID" \
-H "Authorization: Bearer $MLF_API_KEY"{
"data": {
"id": "id_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
"deleted": true
}
}