Get Localization Data via REST API

Get Localization Data via REST API

Use the Twinzo REST API endpoint GET /v3/devices/locations to retrieve localization data for a device as a time-ordered list of recorded positions. This endpoint returns coordinates in the Twinzo sector coordinate system and is useful for tracking movement history, validating incoming localization, or integrating position data into external systems.

This page describes how to read localization data. If you need to send localization data into Twinzo, see Localization Data.

Endpoint overview

Localization works for registered devices. Coordinates are tied to the configured sector and must be interpreted using the Twinzo coordinate system for that sector.

What the endpoint returns

The API returns a list of location samples. Each object represents one recorded position of the device at a specific time.

[ { "Timestamp": 1782381265588, "SectorId": 1, "Interval": 1000, "X": 1000, "Y": 1000 }, { "Timestamp": 1782381265588, "SectorId": 1, "Interval": 1000, "X": 1370, "Y": 1000 } ]

In this example, the response contains two position records in the same sector. The second record shows movement on the X axis from 1000 to 1370, while the Y position remains unchanged at 1000.

Field reference

Field

Type

Description

Field

Type

Description

Timestamp

integer

Unix timestamp in milliseconds representing when the location was recorded.

SectorId

integer

Identifier of the sector where the device location belongs. Use this to map the coordinates to the correct floor, hall, or area in Twinzo.

Interval

integer

Expected time gap between localization records, in milliseconds. This helps consumers understand the sampling frequency of the data stream.

X

number

X coordinate of the device position in millimeters.

Y

number

Y coordinate of the device position in millimeters.

Coordinates are returned in millimeters. If your application expects meters, divide the values by 1000.

How to use it

  1. Authenticate against the Twinzo API using the mechanism configured for your integration.

  2. Call GET /v3/devices/locations.

  3. Parse the returned JSON array.

  4. Use SectorId to place the data into the correct sector context.

  5. Render or process X and Y as device coordinates over time.

A typical integration flow is:

  • Monitoring: show the latest known location of a device

  • Analytics: reconstruct movement paths from successive records

  • Validation: compare expected and actual positions from upstream localization sources

  • Automation: trigger events when devices enter relevant sector regions

Example request and response

GET /v3/devices/locations HTTP/1.1 Host: api.twinzo.com Authorization: Bearer <access-token> Accept: application/json

Example response:

[ { "Timestamp": 1782381265588, "SectorId": 1, "Interval": 1000, "X": 1000, "Y": 1000 }, { "Timestamp": 1782381265588, "SectorId": 1, "Interval": 1000, "X": 1370, "Y": 1000 } ]
The device has two recorded positions in sector 1. Both samples share the same timestamp and interval, which means they belong to the same measurement moment or batch of reported points. The horizontal change in X suggests displacement within the same sector plane.

Important notes

  • Only registered devices can provide meaningful localization data.

  • The returned coordinates depend on the configured sector coordinate system.

  • This response example contains only X and Y. Other localization-related models in Twinzo may include additional properties, but they are not required for this read scenario unless explicitly documented for this endpoint.

  • If you are correlating data with device telemetry, use Timestamp and Interval together to understand sequence and sampling rate.

Do not assume coordinates are globally valid across all sectors. Always interpret position values together with SectorId.

Related references

If you encounter any issues or need assistance with using this product, please do not hesitate to reach out for support. Our team is here to help you resolve any problems and answer any questions you may have.
To create a support ticket, visit our support portal at https://partner.twinzo.eu/helpdesk/customer-care-1