Loading...

PUT /api/zones

If a delivery route gains a new depot, save the map points that outline its zone and assign it to the trackers on the vehicles that visit. The zone’s shape describes the site. The device list determines which vehicles its alerts apply to.

Every selected tracker will receive the same complete list of zones. Include the zones those trackers should keep, because each omitted zone loses its alert on those devices. Send separate requests for vehicles that should have different lists. The response identifies the saved zones.

Request Details

HTTP method PUT
Path /api/zones

The example identifiers are fictional. Use the identifiers returned by your account’s list for the resource you want to look up or change.

Request Parameters

Request body parameters

ParameterTypeRequiredDescription
zonesObject arrayOptionalObject arrayNoComplete zone list for the selected devices. Review their current assignments. If deviceIds contains devices, omitting zones or sending null or [] removes every zone alert from those devices.
deviceIdsString arrayOptionalString arrayNoVisible tracker IDs from GET /api/devices. Substitute an ID from your account. An empty list saves zones without assigning them.

Fields in each zone

ParameterTypeRequiredDescription
idStringOptionalStringNoFor an update, use the full ID from GET /api/zones. Omit the field to create a zone.
nameStringRequiredStringYesZone name.
typeStringRequiredStringYesallowed (allowed area), forbidden (restricted area), checkpoint (checkpoint), checkpoint_area (checkpoint area), or route (route).
widthIntegerOptionalIntegerNoWidth in meters for a checkpoint or route.
pointsObject arrayRequiredObject arrayYesInclude at least one point. Provide numeric latitude and longitude values in degrees for each point.

Authentication Required

You need access to the map and the edit privilege. Demo users have read-only access.

Send a valid bearer token in the authorization header. See Authentication.

Example Request

PUT /api/zones HTTP/1.1 Host: api.plaspy.com Authorization: Bearer {token} Content-Type: application/json

Example Request Body

{ "zones": [ { "name": "North gate", "type": "checkpoint", "width": 50, "points": [ { "latitude": 4.65, "longitude": -74.08 } ] } ], "deviceIds": [ "123456789012345" ] }

Response Parameters

The Presence column describes an HTTP 200 response. Conditional fields are omitted when they have no value. For a list, presence applies to each returned item.

success: true and zones confirm the save. Use the returned identifiers to refer to those zones in later requests.

FieldTypePresenceDescription
zonesObject arrayAlwaysObject arrayAlwaysSaved zones with their public IDs.
apiUsageIntegerAlwaysIntegerAlwaysUsage units for this request.
apiDailyUsageIntegerAlwaysIntegerAlwaysAccount usage for the day before this request is added.
successBooleanAlwaysBooleanAlwaysSet to true on success.

Fields in each zones item

FieldTypePresenceDescription
idStringAlwaysStringAlwaysPublic zone ID (zon-).
nameStringAlwaysStringAlwaysZone name.
typeStringAlwaysStringAlwaysZone type: allowed, forbidden, checkpoint, checkpoint_area or route.
widthIntegerConditionalIntegerConditionalWidth in meters for a checkpoint or route, when applicable.
pointsObject arrayAlwaysObject arrayAlwaysGeometry points. Each point has numeric latitude and longitude values in degrees.

Example Successful Response

HTTP 200.

{ "success": true, "apiUsage": 1, "apiDailyUsage": 24, "zones": [ { "id": "zon-QmXvWNpRkY", "name": "North gate", "type": "checkpoint", "width": 50, "points": [ { "latitude": 4.65, "longitude": -74.08 } ] } ] }

Errors

HTTP statusWhen it occurs
400If a name or point is missing, the type is invalid, the zone identifier cannot be recognized, or a device is not visible. Validation errors appear in errors under the affected field. If the request quota has been reached, error contains the reason.
401A valid bearer token is missing.
403If edit permission is missing.
500An unexpected error occurred while processing the request.

In an error response that includes success, its value is false and error contains the message. Field validation failures can appear in the errors object, with a list of messages for each field.

Example Error Response

{ "success": false, "error": "One of the devices was not found in the account." }
Index
Questions?

We answer all support request within 24 business hours approximately, If you have a question that needs an immediate resolution, please contact us by other way.

We answer you in business hours, as soon as possible. We are located in Bogotá, Colombia, time zone (GMT-5).

Last modification: 2026-11-30 11:01:35