Loading...

POST /api/devices/{deviceId}/locations

Location history is the sequence of points a tracker reported over a period of time. To reconstruct yesterday’s deliveries, you need more than the vehicle’s last known position. The recorded points let you draw the route in order and see when each position was recorded.

Choose a device and send the start and end dates and times in the request body. You can request coordinates for a route map or include readings such as speed. The response lists the recorded positions from oldest to newest.

Request Details

POST /api/devices/{deviceId}/locations

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.
fieldsString arrayOptionalString arrayNoFields in each position. Send a list of names. Matching is case-insensitive and dateTime is always included.

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

Omitting fields returns the usual available fields. Request outputs explicitly to include device outputs. The position fields table lists the accepted names.

Optional fields with no reading can be omitted. The contract allows null values for latitude, longitude and milleage.

Authentication Required

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

Example Request

POST /api/devices/123456789012345/locations 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", "fields": [ "latitude", "longitude" ] }

Response Parameters

Read the locations array. It is empty when the interval contains no positions. Each position returned uses one unit, with a minimum of one per query. If the query uses the last available unit for the user or tracker, the API returns HTTP 200 with the positions retrieved so far.

FieldTypePresenceDescription
locationsObject arrayAlwaysObject arrayAlwaysPositions within the requested interval, oldest first.
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 position

FieldTypePresenceDescription
dateTimeDate-timeIn every positionDate-timeIn every positionRecord date and time in the user’s time zone.
latitudeNumberDepends on selection and dataNumberDepends on selection and dataLatitude of the location.
longitudeNumberDepends on selection and dataNumberDepends on selection and dataLongitude of the location.
speedNumberDepends on selection and dataNumberDepends on selection and dataSpeed in meters per second.
courseNumberDepends on selection and dataNumberDepends on selection and dataCourse (direction) at the location.
batteryIntegerDepends on selection and dataIntegerDepends on selection and dataBattery level of the device at the location.
fuelIntegerDepends on selection and dataIntegerDepends on selection and dataFuel level of the device at the location.
fuel2IntegerDepends on selection and dataIntegerDepends on selection and dataSecondary fuel level at the location.
temperatureNumberDepends on selection and dataNumberDepends on selection and dataTemperature measured at the location.
temperature2NumberDepends on selection and dataNumberDepends on selection and dataSecondary temperature measured at the location.
sensorTime1IntegerDepends on selection and dataIntegerDepends on selection and dataSensor 1 time at the location.
sensorTime2IntegerDepends on selection and dataIntegerDepends on selection and dataSensor 2 time at the location.
sensorTime3IntegerDepends on selection and dataIntegerDepends on selection and dataSensor 3 time at the location.
sensorTime4IntegerDepends on selection and dataIntegerDepends on selection and dataSensor 4 time at the location.
inactiveSecondsIntegerDepends on selection and dataIntegerDepends on selection and dataInactive seconds at the location.
rpmIntegerDepends on selection and dataIntegerDepends on selection and dataRevolutions per minute at the location.
milleageNumberDepends on selection and dataNumberDepends on selection and dataMileage at the location.
warningTextsString arrayDepends on selection and dataString arrayDepends on selection and dataWarning texts at the location.
alertTextsString arrayDepends on selection and dataString arrayDepends on selection and dataAlert texts at the location.
alertsString arrayDepends on selection and dataString arrayDepends on selection and dataAlerts at the location.
warningsString arrayDepends on selection and dataString arrayDepends on selection and dataWarnings at the location.
hasCriticalAlertBooleanDepends on selection and dataBooleanDepends on selection and dataIndicates if there are critical alerts at the location.
attributesObjectDepends on selection and dataObjectDepends on selection and dataAdditional attributes at the location.
accessoriesAttributesObject arrayDepends on selection and dataObject arrayDepends on selection and dataAdditional attributes of accessories at the location.
inputsBoolean arrayDepends on selection and dataBoolean arrayDepends on selection and dataState of the inputs at the location.
outputsBoolean arrayIf requested and availableBoolean arrayIf requested and availableState of the outputs at the location.

Example HTTP 200 response

{ "success": true, "apiUsage": 1, "apiDailyUsage": 12, "apiUserDailyUsage": 38, "locations": [ { "dateTime": "2026-06-10T09:12:00", "latitude": 4.61, "longitude": -74.08 } ] }

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 a field is unknown, the API returns HTTP 400 and lists the accepted names in error. Correct the selection and repeat the query. Also check the identifier and device access.

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:16