Alerts
Alert rules from templates or custom definitions; alarms, acknowledgement and closure.
Base URLhttps://api.ping.nml.sa/v111 operations
Jump to an operation
Common errors
Operations on this page answer these errors in one shape; each operation lists the ones it returns.
400The request is invalid (code: invalid_request), with field errors.401The API key is missing, unknown, expired or revoked (code: unauthorized).403The API key lacks the scope this operation needs (code: forbidden).404No such resource in this account, or outside the key's data scope (code: not_found).409The resource is not in a state that allows this (code: conflict), or the idempotency key is in use.429The key's rate limit is reached (code: rate_limited). Retry after the Retry-After header's seconds.
List alarms
GET/v1/alarms
Alarms opened by the account's rules, newest first. A department-scoped key sees only alarms on its own vehicles.
Scoperules:read
Parameters
limitintegerqueryItems per page, 1 to 200 (default 50).
cursorstringqueryThe next_cursor of the previous page.
statusstringqueryOnly alarms in this status.
e.g.
ackedseveritystringqueryOnly alarms of this severity.
e.g.
warningvehicle_idstringqueryOnly alarms on this vehicle.
e.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9drule_idstringqueryOnly alarms opened by this rule.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0akindstringqueryOnly alarms of this kind (a template id, or custom).
e.g.
overspeedfromstring (date-time)queryOnly alarms seen at or after this time (their last occurrence).
e.g.
2026-11-10T00:00:00Ztostring (date-time)queryOnly alarms opened before this time.
e.g.
2026-11-17T00:00:00Z
Response 200
dataobject[]Fields of data
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
next_cursorstring | nulle.g.
eyJpZCI6InZlaF83S3EyIn0
Errors
curl "https://api.ping.nml.sa/v1/alarms" \
-H "Authorization: Bearer $PING_API_KEY"{
"data": [
{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}
],
"next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}Get an alarm
GET/v1/alarms/{alarmId}
One alarm with its lifecycle and its activity, oldest first: opened, repeated, acknowledged, assigned, commented, closed and reopened, with who and when.
Scoperules:read
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
Response 200
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
activityobject[]Oldest first.
Fields of activity
idstringe.g.
019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2catstring (date-time)e.g.
2026-11-17T08:34:10Zkindstringone of
openedrepeatedackedassignedcommentedclosedreopenedactorstring | nullWho did it (user:<id>); null when the platform did.
e.g.
user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bassigneestring | nulle.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bresolutionstring | nullnotestring | nulle.g.
nulloccurrenceinteger | nulle.g.
null
Errors
curl "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b" \
-H "Authorization: Bearer $PING_API_KEY"{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
],
"activity": [
{
"id": "019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2c",
"at": "2026-11-17T08:34:10Z",
"kind": "assigned",
"actor": "user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"resolution": "actioned",
"note": null,
"occurrence": null
}
]
}Acknowledge an alarm
POST/v1/alarms/{alarmId}/ack
Moves an open alarm to acked and records who acknowledged it and when, with an optional note. Any other status answers 409.
Scoperules:write
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
Request body
notestringe.g.
Driver called.
Response 200
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
Errors
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/ack" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"note": "Driver called."}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}Assign an alarm to a user
POST/v1/alarms/{alarmId}/assign
Gives an open or acked alarm to one of the account's users. An open alarm is acknowledged by the caller as it is assigned. A closed alarm answers 409.
Scoperules:write
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
Request body
assigneestringrequiredAn account user id.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b
Response 200
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
Errors
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/assign" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b"}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}Close an alarm with a note
POST/v1/alarms/{alarmId}/close
Closes an open or acked alarm and records who closed it, when, the resolution (actioned or false positive) and the note. A closed alarm answers 409.
Scoperules:write
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
Request body
resolutionstringrequiredone of
actionedfalse_positivenotestringrequirede.g.
Driver called; speed back to limit.
Response 200
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
Errors
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/close" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"resolution": "actioned", "note": "Driver called; speed back to limit."}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}Add a note to an alarm
POST/v1/alarms/{alarmId}/comments
Adds a note to the alarm's activity, whatever its status.
Scoperules:write Accepts Idempotency-Key
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1bIdempotency-KeystringheaderA unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.
Request body
textstringrequirede.g.
Called the driver; he is pulling over.
Response 201
idstringe.g.
019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2catstring (date-time)e.g.
2026-11-17T08:34:10Zkindstringone of
openedrepeatedackedassignedcommentedclosedreopenedactorstring | nullWho did it (user:<id>); null when the platform did.
e.g.
user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bassigneestring | nulle.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bresolutionstring | nullnotestring | nulle.g.
nulloccurrenceinteger | nulle.g.
null
Errors
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/comments" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Called the driver; he is pulling over."}'{
"id": "019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2c",
"at": "2026-11-17T08:34:10Z",
"kind": "assigned",
"actor": "user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"resolution": "actioned",
"note": null,
"occurrence": null
}Reopen a closed alarm
POST/v1/alarms/{alarmId}/reopen
Puts a closed alarm back to open, unassigned and unacknowledged; its activity keeps what happened before. Any other status answers 409.
Scoperules:write
Parameters
alarmIdstringpath requirede.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
Response 200
idstringe.g.
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
e.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringe.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
e.g.
overspeedseveritystringone of
infowarningcriticalstatusstringopen, then acked (optional), then closed.
one of
openackedclosedopened_atstring (date-time)e.g.
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
e.g.
2026-11-17T08:41:00Zoccurrencesintegere.g.
2assigneestring | nullThe account user the alarm is given to.
e.g.
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
e.g.
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)e.g.
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
e.g.
nullclosed_atstring | null (date-time)e.g.
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
e.g.
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
e.g.
120factsobject[]The facts that held when it opened.
Fields of facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhnumbernumbere.g.
134textstringe.g.
openbooleanbooleane.g.
true
Errors
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/reopen" \
-H "Authorization: Bearer $PING_API_KEY"{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}List alert rules
GET/v1/rules
The account's alert rules, oldest first. A department-scoped key sees only the rules on its own vehicles.
Scoperules:read
Parameters
limitintegerqueryItems per page, 1 to 200 (default 50).
cursorstringqueryThe next_cursor of the previous page.
templatestringqueryOnly rules made from this template; custom for custom rules.
e.g.
overspeedenabledbooleanqueryOnly enabled (true) or disabled (false) rules.
geofence_idstringqueryOnly the rules scoped to this geofence.
e.g.
019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c
Response 200
dataobject[]Fields of data
idstringe.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nulle.g.
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
e.g.
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
one of
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
e.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleane.g.
truecreated_atstring (date-time)e.g.
2026-11-17T08:30:00Zupdated_atstring (date-time)e.g.
2026-11-17T08:30:00Z
next_cursorstring | nulle.g.
eyJpZCI6InZlaF83S3EyIn0
Errors
curl "https://api.ping.nml.sa/v1/rules" \
-H "Authorization: Bearer $PING_API_KEY"{
"data": [
{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{}
],
"limit": [
{}
],
"schedule": {
"mode": "outside",
"hours": {}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}
],
"next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}Create an alert rule
POST/v1/rules
A rule from a built-in template with optional overrides (its parameters typed by the template's catalog), or a custom declarative definition, applied to the whole account, a department (group), one vehicle or one geofence. Give template or definition, not both. A department-scoped key creates rules only on its own vehicles.
Scoperules:write Accepts Idempotency-Key
Parameters
Idempotency-KeystringheaderA unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.
Request body
namestringe.g.
Highway overspeedtemplatestringA built-in template id. Give template or definition.
e.g.
overspeedoverridesobjectChanges to a template's defaults. Omitted fields keep the template's values.
Fields of overrides
paramsobject[]Values for the template's parameters, one per name.
Fields of params
namestringrequirede.g.
limit_kmhnumbernumbere.g.
100hoursobjectDays and hours in a time zone: from from_day to to_day (across the week's end when to_day comes first), from start to end each day (end 24:00 is midnight).
Fields of hours
from_daystringrequiredone of
sunmontuewedthufrisatto_daystringrequiredone of
sunmontuewedthufrisatstartstringrequirede.g.
07:00endstringrequirede.g.
18:00time_zonestringrequiredAn IANA time zone.
e.g.
Asia/Riyadh
hold_sintegerSeconds the conditions must hold before the rule fires.
e.g.
60min_gap_sintegerMinimum seconds between two firings on the same vehicle.
e.g.
900severitystringone of
infowarningcriticalactionsstring[]e.g.
["alarm"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
one of
dispatchworkshopfuelcold_chaincompliancesafety
definitionobjectA custom rule: declarative, no scripting. It fires on the rising edge per vehicle once the conditions hold for hold_s, at most once per min_gap_s per vehicle.
Fields of definition
whenobject[]requiredFields of when
factstringrequiredA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhopstringrequiredchanged: the value differs from the previous record. drop: the value fell by at least number within window_s.
one of
=!=>>=<<=changeddropnumbernumberCompare with this number.
e.g.
100textstringCompare with this text (= and != only).
e.g.
openbooleanbooleanCompare with this boolean (= and != only).
e.g.
truelimitbooleanCompare with the rule's limit.
one of
truewindow_sintegerSeconds over which drop is measured; only for drop.
e.g.
900
limitobject[]The threshold a condition with limit true compares with: the first term that has a value. Required when a condition uses it.
Fields of limit
factstringe.g.
vehicle.speed_limit_kmhnumbernumbere.g.
100paramstringe.g.
limit_kmh
scheduleobjectWhen a custom rule applies: inside or outside the hours, or (hours null) the account's operating calendar: its operating week and hours (accounts), Ramadan's hours and the Kingdom's holidays (closed).
Fields of schedule
modestringrequiredone of
insideoutsidehoursobject | nullrequired
hold_sintegerrequiredSeconds the conditions must hold before the rule fires.
e.g.
30min_gap_sintegerrequiredMinimum seconds between two firings on the same vehicle.
e.g.
600severitystringrequiredone of
infowarningcriticalactionsstring[]requirede.g.
["alarm","notify"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
one of
dispatchworkshopfuelcold_chaincompliancesafetylatestringCritical rules only: still notify on records that arrive late (buffered while out of coverage), marked delayed.
one of
notify
scope_kindstringrequiredWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
one of
customergroupvehiclegeofencescope_idstringThe department (group), vehicle or geofence id; required for group, vehicle and geofence, omitted for customer.
e.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleane.g.
true
Response 201
idstringe.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nulle.g.
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
e.g.
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
one of
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
e.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleane.g.
truecreated_atstring (date-time)e.g.
2026-11-17T08:30:00Zupdated_atstring (date-time)e.g.
2026-11-17T08:30:00Z
Errors
curl -X POST "https://api.ping.nml.sa/v1/rules" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Highway overspeed", "template": "overspeed", "scope_kind": "vehicle", "scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d", "enabled": true}'{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{
"name": "limit_kmh",
"number": 100,
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{
"fact": "position.speed_kmh",
"op": ">",
"number": 100,
"text": "open",
"boolean": true,
"limit": true,
"window_s": 900
}
],
"limit": [
{
"fact": "vehicle.speed_limit_kmh",
"number": 100,
"param": "limit_kmh"
}
],
"schedule": {
"mode": "outside",
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}Update an alert rule
PATCH/v1/rules/{ruleId}
Changes the fields given and keeps the rest. overrides applies to template rules and definition to custom rules; each replaces the stored value whole. An empty name clears the name; scope_kind and scope_id change together.
Scoperules:write
Parameters
ruleIdstringpath requirede.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a
Request body
namestringAn empty name clears it.
e.g.
Highway overspeedoverridesobjectChanges to a template's defaults. Omitted fields keep the template's values.
Fields of overrides
paramsobject[]Values for the template's parameters, one per name.
Fields of params
namestringrequirede.g.
limit_kmhnumbernumbere.g.
100hoursobjectDays and hours in a time zone: from from_day to to_day (across the week's end when to_day comes first), from start to end each day (end 24:00 is midnight).
Fields of hours
from_daystringrequiredone of
sunmontuewedthufrisatto_daystringrequiredone of
sunmontuewedthufrisatstartstringrequirede.g.
07:00endstringrequirede.g.
18:00time_zonestringrequiredAn IANA time zone.
e.g.
Asia/Riyadh
hold_sintegerSeconds the conditions must hold before the rule fires.
e.g.
60min_gap_sintegerMinimum seconds between two firings on the same vehicle.
e.g.
900severitystringone of
infowarningcriticalactionsstring[]e.g.
["alarm"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
one of
dispatchworkshopfuelcold_chaincompliancesafety
definitionobjectA custom rule: declarative, no scripting. It fires on the rising edge per vehicle once the conditions hold for hold_s, at most once per min_gap_s per vehicle.
Fields of definition
whenobject[]requiredFields of when
factstringrequiredA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
e.g.
position.speed_kmhopstringrequiredchanged: the value differs from the previous record. drop: the value fell by at least number within window_s.
one of
=!=>>=<<=changeddropnumbernumberCompare with this number.
e.g.
100textstringCompare with this text (= and != only).
e.g.
openbooleanbooleanCompare with this boolean (= and != only).
e.g.
truelimitbooleanCompare with the rule's limit.
one of
truewindow_sintegerSeconds over which drop is measured; only for drop.
e.g.
900
limitobject[]The threshold a condition with limit true compares with: the first term that has a value. Required when a condition uses it.
Fields of limit
factstringe.g.
vehicle.speed_limit_kmhnumbernumbere.g.
100paramstringe.g.
limit_kmh
scheduleobjectWhen a custom rule applies: inside or outside the hours, or (hours null) the account's operating calendar: its operating week and hours (accounts), Ramadan's hours and the Kingdom's holidays (closed).
Fields of schedule
modestringrequiredone of
insideoutsidehoursobject | nullrequired
hold_sintegerrequiredSeconds the conditions must hold before the rule fires.
e.g.
30min_gap_sintegerrequiredMinimum seconds between two firings on the same vehicle.
e.g.
600severitystringrequiredone of
infowarningcriticalactionsstring[]requirede.g.
["alarm","notify"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
one of
dispatchworkshopfuelcold_chaincompliancesafetylatestringCritical rules only: still notify on records that arrive late (buffered while out of coverage), marked delayed.
one of
notify
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
one of
customergroupvehiclegeofencescope_idstringGive with scope_kind (omitted for customer).
e.g.
019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8cenabledbooleane.g.
false
Response 200
idstringe.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nulle.g.
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
e.g.
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
one of
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
e.g.
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleane.g.
truecreated_atstring (date-time)e.g.
2026-11-17T08:30:00Zupdated_atstring (date-time)e.g.
2026-11-17T08:30:00Z
Errors
curl -X PATCH "https://api.ping.nml.sa/v1/rules/019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Highway overspeed", "scope_kind": "vehicle", "scope_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c", "enabled": false}'{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{
"name": "limit_kmh",
"number": 100,
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{
"fact": "position.speed_kmh",
"op": ">",
"number": 100,
"text": "open",
"boolean": true,
"limit": true,
"window_s": 900
}
],
"limit": [
{
"fact": "vehicle.speed_limit_kmh",
"number": 100,
"param": "limit_kmh"
}
],
"schedule": {
"mode": "outside",
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}Delete an alert rule
DELETE/v1/rules/{ruleId}
The rule stops evaluating. Alarms it opened remain, with rule_id set to null.
Scoperules:write
Parameters
ruleIdstringpath requirede.g.
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a
Response 204
Deleted.
Errors
curl -X DELETE "https://api.ping.nml.sa/v1/rules/019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a" \
-H "Authorization: Bearer $PING_API_KEY"