REST API

REST API: getting started

The SafarTrak API gives your ERP, TMS, BI and in-house tools secure access to your fleet data over HTTPS, with JSON responses.

Overview

  • Style: REST over HTTPS, JSON responses.
  • Authentication: API key ID and secret in request headers, or HTTP Basic.
  • Scope: each key sees only your company's fleet data and can be revoked at any time.
  • Coverage: vehicles and live location, route history, temperature, alerts, analytics, utilisation, trip schedules and reference data. See the endpoint reference.

1. Create credentials

In the SafarTrak portal, open API Credentials and create an API key. You receive a key ID and a secret. The secret is shown once, so store it safely, for example in your server's secret manager.

2. Base URL

All endpoint paths are relative to this base URL.

Base URL
https://safartrack-backend.safartrak.com/api/v1/external

3. Authentication

Send the key ID and secret as headers on every request. HTTP Basic authentication, with the key ID as the username and the secret as the password, is also accepted.

Headers
X-API-Key: <your API key ID>
X-API-Password: <your API secret>

Examples

List the vehicles that are moving right now, then fetch yesterday's route for one vehicle.

Vehicles that are moving
curl "https://safartrack-backend.safartrak.com/api/v1/external/vehicles?status=moving&page=1&limit=50" \
  -H "X-API-Key: $SAFARTRAK_API_KEY" \
  -H "X-API-Password: $SAFARTRAK_API_SECRET"
Yesterday's route for one vehicle
curl "https://safartrack-backend.safartrak.com/api/v1/external/vehicles/VEHICLE_ID/route-history?period=yesterday" \
  -H "X-API-Key: $SAFARTRAK_API_KEY" \
  -H "X-API-Password: $SAFARTRAK_API_SECRET"

Replace VEHICLE_ID with the vehicle's uniqueId from the /vehicles response.

Conventions

  • Every successful response includes success: true; errors return success: false with a message.
  • List endpoints accept page and limit.
  • Date-based endpoints accept from and to; route history also accepts a period such as today or yesterday.
  • Vehicles are identified by uniqueId (the device ID). Search by registration number with /vehicles?search=.

See responses and errors for status codes.

Keeping keys safe

Questions about the API or MCP? Email support@safartrak.com (24/7) or contact the team.