Traccar API

Starting from version 3.0 Traccar server includes an API to access GPS tracking data from your own applications. Documentation for the API can be found in the API Reference or the OpenAPI JSON spec file. There are a lot of tools available to automatically generate client code from OpenAPI format. For more information check the official OpenAPI website.

There are two authorization options:

Official Traccar API documentation:

Access token

As an alternative to email and password login, there is an option to use account token for authorization. Token can be set in the corresponding field of the user model. Token can only be used to create a session. It can not be used for basic authorization option.

To create a token use "token" query parameter in session get request:

/api/session?token=USER_TOKEN

WebSocket API

In addition to Traccar REST API, we provide access to a WebSocket endpoint for live location updates and events. URL for the connection:

/api/socket

Session cookie is the only authorization option for WebSocket connection.

Each message in WebSocket communication uses same universal JSON format:

{
  "devices": [...],
  "positions: [...],
  "events": [...]
}

Each array contains corresponding standard models:

If message does not contain objects of one of the types, the key would not be included in the JSON structure. Most of the time messages contain a single type of objects.