Loading...

POST /api/devices/{deviceId}/alerts

An alert event is a record of something that already happened on a device, such as a speeding event. To investigate an incident from yesterday’s shift, look up the events recorded for that vehicle during the shift.

Supply the device and the period you want to review. Each returned event includes the time and location so you can place it on the route. To set up the alerts you want to receive in the future, see Alerts API.

Request Details

POST /api/devices/{deviceId}/alerts

Request Parameters

Path parameters

ParameterTypeRequiredDescription
deviceIdStringRequiredStringYesTracker identifier in the path. Use the id from the device list.

JSON body parameters

ParameterTypeRequiredDescription
fromDate-timeRequiredDate-timeYesStart of the interval in ISO 8601 format. The example uses UTC.
toDate-timeRequiredDate-timeYesEnd of the interval in ISO 8601 format. Split longer periods into queries of up to 1,440 minutes.
alertNameStringOptionalStringNoExact event type, for example SpeedLimit. Names are case-sensitive. An omitted or unrecognised value returns events of all types.

Replace the sample identifier with a device id visible in GET /api/devices.

Authentication Required

Send the access token in the Authorization: Bearer <token> header. See Authentication.

Example Request

POST /api/devices/123456789012345/alerts HTTP/1.1 Host: api.plaspy.com Authorization: Bearer {token} Content-Type: application/json

Example Request Body

{ "from": "2026-06-10T09:00:00Z", "to": "2026-06-10T10:00:00Z" }

Response Parameters

If the query uses the last available unit for the user or tracker, the API returns HTTP 200 with the matching alerts found so far. The minimum charge is one unit, even if there were no records to examine. This can happen before the search finds an event matching the filter.

The alerts array contains matching events. This example has no matches. Usage counts the records examined, including when you apply a filter.

FieldTypePresenceDescription
alertsObject arrayAlwaysObject arrayAlwaysRecorded events matching the query.
successBooleanAlwaysBooleanAlwaysIn a successful response, true confirms the operation.
apiUsageIntegerAlwaysIntegerAlwaysUnits charged for this request.
apiDailyUsageIntegerAlwaysIntegerAlwaysAPI units all users had used for this tracker today before this request.
apiUserDailyUsageIntegerAlwaysIntegerAlwaysAPI units the user had used today before this request.

Fields in each event

FieldTypePresenceDescription
dateTimeDate-timeAlwaysDate-timeAlwaysRecord date and time in the user’s time zone.
latitudeNumberAlwaysNumberAlwaysLatitude of the alert.
longitudeNumberAlwaysNumberAlwaysLongitude of the alert.
textStringWhen setStringWhen setDescriptive text of the alert.
notificationsString arrayAlwaysString arrayAlwaysList of notifications.
alertsString arrayAlwaysString arrayAlwaysList of associated alerts.

Example HTTP 200 response

{ "success": true, "apiUsage": 1, "apiDailyUsage": 12, "apiUserDailyUsage": 38, "alerts": [] }

Example event

This item in the alerts array is a speed event with a push notification.

{ "dateTime": "2026-06-10T09:12:00", "latitude": 4.61, "longitude": -74.08, "text": "Fleet speed limit", "notifications": [ "Push" ], "alerts": [ "SpeedLimit" ] }

Errors

FieldTypePresenceDescription
successBooleanDepends on the errorBooleanDepends on the errorIn the operation errors shown here, the value is false.
errorStringDepends on the errorStringDepends on the errorMessage explaining why the request was rejected.

The tracker must be enabled. The call uses both the user’s allowance and the tracker’s shared allowance. If either allowance is already exhausted when the query starts, the API returns HTTP 400 with success set to false. These are examples of the error field.

  • User — Your user has reached its daily API request limit of 4000 requests (used 4000). The limit resets at 00:00 UTC.
  • Tracker — You have reached your daily API request limit of 2000 requests (used 2000). The limit resets at 00:00 UTC.

If the message says the date range is too long, shorten the interval and run the query again.

Example HTTP 400 error

{ "success": false, "error": "Maximum date range is 1440 minutes." }
Index
Last modification: 2026-11-30 22:48:24