# Cartrack for Developers --- --- Plain-markdown copy of the documentation at https://developer.cartrack.com/. The Fleet API endpoint reference is the OpenAPI specification at https://developer.cartrack.com/openapi/openapi.yaml. --- --- # Authentication Source: https://developer.cartrack.com/docs/fleet-api-general/authentication To use Cartrack services and the Fleet API, you must have an account. The Cartrack Fleet API uses HTTP Basic Authentication. Requests must include an `Authorization` header containing a Base64‑encoded `username:password` pair. Always use HTTPS when sending credentials. There are two primary user roles: - **Administrator:** Full access to account settings and fleet data; responsible for issuing credentials and managing user permissions. - **Subuser:** Access limited to features and data permitted by an Administrator. Fleetweb writes this as "sub-user"; the API reference and the endpoint and field names use "subuser" (`/subusers`, `subuser_id`). ## Administrator Administrators sign in to Fleetweb with the credentials provided by Cartrack. Typical responsibilities include: - Issuing API credentials to subusers and integrations. - Creating and managing subuser accounts and access permissions in Fleetweb. - Maintaining fleet configuration and access controls. ## Subuser Administrators can create and manage subusers in Fleetweb and assign permissions appropriate to their role. If you require access, request it from your organization's Fleetweb Administrator. A subuser authenticates with the main account's username together with the subuser's own API password, so the username is shared across the account and only the password identifies the subuser. ### Delivery access limits Subuser credentials are read-only across the whole Delivery family. Before you build an integration on them, check these limits: - Every `POST`, `PUT` and `DELETE` under `/delivery/` returns `403 Forbidden` when the request is authenticated with a subuser API password. - Most Delivery reads do accept subuser credentials, but they return the whole account's data with no filtering by subuser. A subuser API password does not narrow what a Delivery read returns. - A few Delivery reads require the main account's API password and also return `403 Forbidden` for a subuser. `GET /delivery/reports/drivers` is one of them. To create or update a delivery resource on behalf of a subuser, authenticate with the main account's API password and set `subuser_id`: as a request body field on delivery jobs and drivers, on create and update, and as a column in the uploaded file on `POST /delivery/jobs/bulk-upload`. That is the supported way to attribute a delivery write to a subuser. These limits apply to Delivery only. On the rest of the API a subuser sees only what the Administrator has granted it, for example its permitted vehicle listings. ## Fleetweb Access Use the region-specific Fleetweb URL for your account. Select your country below to open the correct Fleetweb endpoint: _Interactive content, see https://developer.cartrack.com/docs/fleet-api-general/authentication_ ## Generating Administrator and Subuser API passwords In order to generate API credentials, you will need to connect to Fleetweb. Sign in to your region's Fleetweb site (for example: `https://fleetweb-.cartrack.com`). Open the API Settings page at `https://fleetweb-.cartrack.com/settings/api-settings` (Settings → API Settings in the Fleetweb menu). See screenshot below. ![Access Admin Section](/img/fleetweb/finding-api-section.png "Administrator credentials page") ### Administrator password Generate a new Administrator password following the on-screen prompts. ![API Section Admin](/img/fleetweb/api-section-admin.png "API Admin part") Store the password securely and share it only with trusted personnel. ### Subuser API password Use the "Generate User Credentials" button in the User Credentials section to create a new password for the integration or partner. ![API Section User](/img/fleetweb/api-section-subuser.png "API User part") Assign only the scopes/permissions required and store the password securely. Note that a subuser password cannot write to the Delivery endpoints: see [Delivery access limits](#delivery-access-limits). Notes - Use subuser accounts for external integrations when possible; reserve Administrator credentials for management tasks. An integration that writes to `/delivery/` is the exception and needs the main account's credentials. - If your account is hosted in a different region, use the corresponding Fleetweb and API base URL — otherwise authentication will fail with HTTP 401. - Refer to the Base URLs page for region codes and endpoints. ## Identifying Username and Password For Administrator, the username and password are found here: ![Admin Username and Password](/img/fleetweb/api-section-authentication-admin.png) For subusers, the username will be the same as the administrator, but the password will be different. You can find the subuser password here: ![User Username and Password](/img/fleetweb/api-section-authentication-sub.png) ## How to construct the header 1. Concatenate your username, a colon (`:`), and your password: `username:password`. 2. Base64‑encode that string. This side can be useful: https://www.base64encode.org, however most API clients such as Postman offer the functionality to do this for you by selecting "Basic Auth" in the Authorization tab. 3. Add the encoded value to the `Authorization` header prefixed with `Basic`. ### Example (raw header) ```http Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= ``` If you want, you can have it a try and decode this text here: https://www.base64decode.org ## Quick examples curl ```bash curl -u "username:password" "https://fleetapi-za.cartrack.com/rest/vehicles" ``` JavaScript (fetch) ```javascript const credentials = btoa(`${username}:${password}`); fetch('https://fleetapi-za.cartrack.com/rest/vehicles', { headers: { 'Authorization': `Basic ${credentials}` } }); ``` ## Security best practices - Always use HTTPS — never send credentials over plain HTTP. - Do not embed credentials directly in client-side code that may be public. - Store credentials securely (environment variables, secret managers, vaults). - Use least privilege: generate subuser API passwords for integrations instead of sharing administrator credentials. Delivery is the exception, because subuser credentials cannot write to `/delivery/` and do not narrow what a Delivery read returns (see [Delivery access limits](#delivery-access-limits)). - Rotate and revoke credentials regularly; update integrations after rotation. - If you receive HTTP 401 Unauthorized, verify you're using the correct regional endpoint for your account (see Base URLs). --- # Base URLs Source: https://developer.cartrack.com/docs/fleet-api-general/base-url Correct base URLs ensure optimal performance, correct data routing, and compliance with regional requirements. Cartrack accounts are hosted by region — using the wrong regional endpoint for an account can prevent authentication and will typically return HTTP 401 Unauthorized. Use the region-specific endpoint for the account you are working with. ## Base URL template _Interactive content, see https://developer.cartrack.com/docs/fleet-api-general/base-url_ - Replace `` with the two-letter country code (ISO alpha-2). - Example: . ## Supported countries (code — name) Domain note: - `ke` (Kenya) and `sa` (Kingdom of Saudi Arabia) use the `karooooo.com` domain. - All other supported countries use the `cartrack.com` domain. - au — Australia - bw — Botswana - es — Spain - hk — Hong Kong - id — Indonesia - ke — Kenya - kh — Cambodia - me — Middle East - mw — Malawi - my — Malaysia - mz — Mozambique - na — Namibia - ng — Nigeria - nz — New Zealand - ph — Philippines - pl — Poland - pt — Portugal - rw — Rwanda - sa — Kingdom of Saudi Arabia - sg — Singapore - sz — Swaziland - th — Thailand - tz — Tanzania - vn — Vietnam - za — South Africa - zm — Zambia - zw — Zimbabwe ## Quick example (curl) _Interactive content, see https://developer.cartrack.com/docs/fleet-api-general/base-url_ Notes: - Verify which country code is associated with your account (ask your Fleetweb Administrator). - For the canonical API reference see the [API References](/docs/applications/fleet-api) page. ![Example of base URL](/img/api/base_urls.png "Example of base URL") --- # Follow Fleet API Releases Source: https://developer.cartrack.com/docs/fleet-api-general/follow-releases Every Fleet API release note on the [changelog pages](/docs/fleet-api-general/changelog) is also published in machine-readable form. Use the feeds to get notified of new releases in a feed reader or chat tool, or read `changelog.json` to react to changes from your own code, for example to flag deprecated endpoints your integration still calls. The feeds and files contain exactly what the changelog pages show, and are updated with every release. ## Feeds | Format | URL | Content | |---|---|---| | RSS 2.0 | [`/changelog/rss.xml`](pathname:///changelog/rss.xml) | Latest 20 releases, full text | | Atom | [`/changelog/atom.xml`](pathname:///changelog/atom.xml) | Latest 20 releases, full text | | JSON Feed 1.1 | [`/changelog/feed.json`](pathname:///changelog/feed.json) | Latest 20 releases, full text as HTML and markdown | Each release is one item, identified by a stable ID that never changes once published, so a feed reader shows each release once. ### Feeds per API area Release notes are tagged with the API area they concern, such as **Geofences** or **Trips**. Each area has its own RSS feed at `/changelog/.xml`, containing only that area's changes from the latest 20 releases that touched it. Areas use the names written in the release notes, so a topic can appear under more than one name (for example **Delivery** and **Delivery Jobs**). Subscribe to each name that matters to you, or filter `changelog.json` by endpoint instead. _Interactive content, see https://developer.cartrack.com/docs/fleet-api-general/follow-releases_ ## Structured data: changelog.json [`/changelog.json`](pathname:///changelog.json) holds one record per release-note bullet for the latest 20 releases, newest first, in `entries`. It also lists those releases in `releases`, and the feed URLs in `feeds`. ```json { "version": "1.26.0930.1", "date": "2026-09-30", "kind": "deprecation", "section": "Improvements", "area": "Vehicle Commands", "contract": ["v1"], "endpoints": [ "PUT /vehicles/{registration}/immobilise", "GET /vehicles/immobilise/status" ], "breaking": false, "text": "`PUT /vehicles/{registration}/immobilise` and `GET /vehicles/immobilise/status` are no longer listed in the API reference. Both keep serving their existing callers; new integrations should use the start-inhibit endpoints above." } ``` | Field | Description | |---|---| | `version` | Fleet API version the change shipped in. | | `date` | Release date, `YYYY-MM-DD`. | | `kind` | `feature`, `improvement`, `fix`, `deprecation`, `breaking` or `other`. See below. | | `section` | The heading the bullet appears under on the changelog page, for example `New Features`. | | `area` | The API area tag, or `null` for older releases written before areas were tagged. | | `contract` | API contract versions the change applies to. Currently always `["v1"]`. | | `endpoints` | Endpoints named in the bullet, as `METHOD /path`. Empty when the change is not tied to specific endpoints. | | `breaking` | `true` when the change is listed under a Breaking Changes heading. | | `text` | The release-note text, in markdown. | `kind` comes from the section heading: **New Features** is `feature`, **Improvements** is `improvement`, **Bug Fixes** is `fix`. A bullet that deprecates something, or removes an endpoint from the API reference, is `deprecation` whichever section it is listed in. ### Older releases `changelog.json` covers the latest 20 releases. Every release, back to the first, is listed in [`/changelog/versions/index.json`](pathname:///changelog/versions/index.json), and each has its own file at `/changelog/versions/.json` with the same records. Each version file links to the one before and after it in `previous` and `next`, so you can page back from any release. ## Polling efficiently All feeds and JSON files are served with `ETag` and `Last-Modified` headers. Send them back with `If-None-Match` or `If-Modified-Since`, and you get `304 Not Modified` with no body until something changes: ```bash # First request: keep the ETag from the response headers curl -si https://developer.cartrack.com/changelog.json | grep -i '^etag' # ETag: "6abe16bf-11135" # Later requests: send it back. 304 means nothing has changed. curl -s -o /dev/null -w '%{http_code}\n' \ -H 'If-None-Match: "6abe16bf-11135"' https://developer.cartrack.com/changelog.json # 304 ``` Releases ship a few times a month, so checking once an hour is plenty. The files can be fetched from a web page on any domain. In browser code, call `fetch()` without setting `If-None-Match` yourself: the browser revalidates with the `ETag` automatically, and setting the header by hand makes the browser send an extra preflight request first. ## AI tools For AI assistants and crawlers, the site publishes: - [`/llms.txt`](pathname:///llms.txt): an index of the documentation pages, the OpenAPI specification and the changelog data above, following the [llms.txt](https://llmstxt.org) convention. - [`/llms-full.txt`](pathname:///llms-full.txt): the documentation and the latest 20 releases as a single markdown file. Point your assistant at `llms.txt` to give it the Fleet API documentation, and at the [OpenAPI specification](pathname:///openapi/openapi.yaml) for the exact endpoints and schemas. --- # Overview Source: https://developer.cartrack.com/docs/fleet-api-general/overview The Cartrack Fleet API helps you connect your systems to fleet data and operations so you can monitor vehicles, automate workflows, and build fleet-facing products. This page is the recommended starting point for both business and technical teams before going deeper into endpoint details. ## What the Fleet API enables Examples of what you can do with the Fleet API include, but are not limited to: - View vehicle, trip, and event data to improve operational visibility. - Integrate driver, fuel, route, and delivery workflows into your own platforms. - Trigger business actions from telemetry and status updates. - Build internal dashboards, alerts, and process automations. ## Recommended integration path Follow these pages in order for a faster and clearer setup: 1. **Confirm your integration goals** in [Use Cases](/docs/fleet-api-general/use-cases). 2. **Prepare account access, roles, and validate credentials** in [Authentication](/docs/fleet-api-general/authentication). 3. **Get your regional API endpoint** in [Base URLs](/docs/fleet-api-general/base-url). 5. **Run your first request** with [Quick Start](/docs/fleet-api-general/quick-start). 6. **Harden for production** with [Rate Limiting](/docs/fleet-api-general/rate-limiting) and [Webhook Notifications](/docs/fleet-api-general/webhook-notification). 7. **Implement specific business flows** under [Guides](/docs/fleet-api-general/use-cases) and full [API References](/docs/applications/fleet-api). ## How business and technical teams can collaborate - Agree on priority workflows first (for example: tracking, delivery, driver assignment, or fuel monitoring). - Define data ownership and expected refresh behavior (pull APIs vs webhook events). - Validate API access, roles, and environments before development starts. - Pilot with a small fleet scope, then scale after monitoring and error-handling checks. ## Next step Start with [Authentication](/docs/fleet-api-general/authentication) to confirm access, roles, and account readiness. --- # Quick Start Source: https://developer.cartrack.com/docs/fleet-api-general/quick-start :::tip Get started immediately and perform your first API request to retrieve the vehicles list [here](/docs/fleet-api/get-vehicles-list). ::: Getting started with the Cartrack Fleet API is straightforward. This section provides a basic example of how to make your first API call using curl, JavaScript, or Python. ## Prerequisites Before you proceed, make sure you have: - **An HTTP client**: curl (available on Unix, Linux, macOS, and Windows), or an HTTP library in your language of choice (e.g. `requests` for Python, `fetch` for JavaScript). - **Base URL and Authentication Credentials**: You will need the base URL for the Cartrack Fleet API and valid credentials. For detailed guidance on obtaining these, please refer to the [Authentication](/docs/fleet-api-general/authentication) and [Base URLs](/docs/fleet-api-general/base-url) sections of our documentation. ## Making an API Call The example below retrieves the list of vehicles. Replace `{baseUrl}` with your regional base URL and supply your credentials (see [Authentication](/docs/fleet-api-general/authentication)). **curl** ```bash curl --location '{baseUrl}/rest/vehicles' \ --header 'Accept: application/json' \ --header 'Authorization: Basic your_encoded_credentials' ``` **JavaScript** ```javascript const credentials = btoa('username:password'); const response = await fetch('{baseUrl}/rest/vehicles', { headers: { 'Accept': 'application/json', 'Authorization': `Basic ${credentials}`, }, }); const data = await response.json(); console.log(data); ``` **Python** ```python import requests response = requests.get( '{base_url}/rest/vehicles', auth=('username', 'password'), headers={'Accept': 'application/json'}, ) print(response.json()) ``` ## Response The API will return a JSON response containing a list of vehicles, each with details like vehicle ID, model, and other relevant information. For more detail on the available endpoints and request/response schemas, see the [Fleet API reference](/docs/fleet-api/fleet-api). ## Import to Postman You can import the Cartrack OpenAPI specification into Postman to generate a ready-to-use collection of requests. - Spec URL: [https://developer.cartrack.com/openapi/openapi.yaml](https://developer.cartrack.com/openapi/openapi.yaml) - In Postman: click **Import → Link**, paste the URL, then click **Import**. Or use **Import → File** and upload the downloaded `openapi.yaml`. - Postman will create a collection of requests based on the spec. - Configure environment values: - Set the base URL using the guidance on the [Base URLs](/docs/fleet-api-general/base-url) page. - Configure authentication: Cartrack APIs use **Basic Authentication**. In Postman, open any request, go to the **Authorization** tab, choose **Basic Auth**, and enter your username and password. Alternatively, add the `Authorization` header with the value `Basic `. See the [Authentication](/docs/fleet-api-general/authentication) page for details on generating credentials. - Run individual requests or use the Collection Runner to execute multiple calls. --- # Rate Limiting Source: https://developer.cartrack.com/docs/fleet-api-general/rate-limiting The Cartrack Fleet API applies rate limiting to all incoming API requests to protect network resources, maintain system performance, and ensure a consistent experience for all users. ### Default Rate Limit The API has a default rate limit of **1,000 requests per minute**. This limit applies across most API endpoints unless otherwise specified. Any requests exceeding this limit will receive an HTTP `429 Too Many Requests` response. ### API Endpoint Specific Rate Limit Some API endpoints have stricter rate limits to ensure fairness and prevent abuse. Below are the specific limits for these endpoints: | **Endpoint** | **Rate Limit** | **Description** | |---------------------------------------------------------------|----------------------------------|------------------------------------------------------------------------| | [POST /fuel/consumed](/docs/fleet-api/retrieve-fuel-consumed-sensor-data-for-multiple-vehicles) | 10 requests per minute | Retrieve fuel used estimate for multiple vehicles. | | [POST /fuel/level](/docs/fleet-api/retrieve-fuel-used-estimate-for-multiple-vehicles) | 10 requests per minute | Retrieve fuel consumed sensor data for multiple vehicles. | | [POST /vehicles/ev-consumption](/docs/fleet-api/retrieve-electric-vehicles-estimated-battery-consumptions) | 10 requests per minute | Retrieve battery consumption for multiple electric vehicles. | | [POST /vehicles/range](/docs/fleet-api/retrieve-multiple-electric-vehicles-remaining-range) | 10 requests per minute | Retrieve EV range reported events for multiple electric vehicles. | | [POST /vehicles/soc](/docs/fleet-api/retrieve-multiple-electric-vehicles-state-of-charge-so-c-events) | 10 requests per minute | Retrieve state of charge (SoC) events for multiple electric vehicles. | | [GET /vehicles/status](/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) | 60 requests per minute | Retrieve the latest snapshot for the entire fleet. | | [GET /vehicles/events](/docs/fleet-api/get-events-for-all-vehicles) | 60 requests per minute | Retrieve events for all vehicles in the fleet. | | [GET /vehicles/\{registration\}/events](/docs/fleet-api/get-events-for-one-vehicle) | 200 requests per minute | Retrieve events for a specific vehicle. | | [GET /vehicles/\{registration\}/events/idling](/docs/fleet-api/get-idling-events-for-one-vehicle) | 200 requests per minute | Retrieve idling events for a specific vehicle. | | [GET /vehicles/vext](/docs/fleet-api/get-vehicles-vext-at-ignition-off) | 10 requests per minute | Retrieve vehicles VEXT data regardless of ignition status. | | [GET /vision/status](/docs/fleet-api/get-vision-camera-online-status) | 6 requests per minute | Retrieve the current online status of Vision cameras across the fleet. | For endpoint-specific rate limits, exceeding the limit will also result in an HTTP `429 Too Many Requests` response. ### Vehicle Command Cooldown In addition to the request rate limits above, the vehicle command endpoints apply a cooldown to prevent duplicate commands: - [PUT /vehicles/\{registration\}/central-locking](/docs/fleet-api/send-command-to-lock-or-unlock-a-vehicle) - [POST /vehicles/commands/\{registration\}](/docs/fleet-api/send-command-to-sound-horn-or-turn-on-hazard-lights-on-vehicle) Once a command is accepted, the same command cannot be sent again to the same vehicle while the previous one is still being processed, for up to **30 seconds**. During this window the API responds with an HTTP `409 Conflict` and a `Retry-After` header indicating the number of seconds to wait before retrying. The cooldown applies per vehicle and per command: sending a different command to the same vehicle, or the same command to a different vehicle, is not affected. **Example Response** ```json HTTP/1.1 409 Conflict Content-Type: application/json Retry-After: 30 { "data": null, "error": { "code": 409, "message": "Cannot send lock/lock simultaneously. Try again later." } } ``` ### Retry Behavior If you receive a HTTP `429 Too Many Requests` response, you must respect the headers included in the response. These headers provide information about when you can retry: - `X-RateLimit-Retry-At`: The timestamp of the next earliest retry. - `X-RateLimit-Retry-After-Seconds`: The number of seconds until the next earliest retry. **Example Response** ```json HTTP/1.1 429 Too Many Requests Content-Type: application/json X-RateLimit-Retry-At: 1737592000 X-RateLimit-Retry-After-Seconds: 15 { "error": { "code": 429, "message": "Too many requests. Please wait before retrying." } } ``` **How to Handle `429 Too Many Requests`** - **Wait and Retry**: Respect the `X-RateLimit-Retry-At` and `X-RateLimit-Retry-After-Seconds` header to wait for the recommended time before retrying. - **Exponential Backoff**: Implement exponential backoff with jitter to avoid repeated rate-limit violations. **Notes**: Repeated violations of rate limits may result in temporary or permanent access restrictions. ### Increasing the Limit If your application requires a higher rate limit, you may submit a request for a limit increase. Requests will be evaluated on a case-by-case basis to ensure compatibility with our infrastructure. Approved limits will be customized and communicated accordingly. --- # Carpool Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/carpool-services Carpool is Cartrack's shared vehicle booking system: drivers request a pool vehicle for a scheduled time window, a manager approves or declines the request, and the vehicle's actual pickup and return are tracked against that window. This page explains the read-only Carpool endpoints, with a focus on the booking lifecycle and the `booking_status` values on `GET /carpool/bookings`. ## Which Endpoint Should I Use? Use this mapping based on what you want to accomplish: | Goal | Endpoint | |------|----------| | Search or list bookings by vehicle, driver, date range, or status | [Get All Carpool Bookings](https://developer.cartrack.com/docs/fleet-api/get-all-carpool-bookings) | | Get full detail for a single booking | [Get Carpool Booking by Booking ID](https://developer.cartrack.com/docs/fleet-api/get-carpool-booking-by-booking-id) | | List vehicles enabled for carpool use, their category, and setup completeness | [Get All Carpool Enabled Vehicles](https://developer.cartrack.com/docs/fleet-api/get-all-carpool-enabled-vehicles) | | List the vehicle categories available for booking | [Get All Carpool Vehicle Categories](https://developer.cartrack.com/docs/fleet-api/get-all-carpool-vehicle-categories) | | List drivers registered for carpool use and their booking eligibility | [Get All Registered Carpool Drivers](https://developer.cartrack.com/docs/fleet-api/get-all-registered-carpool-drivers) | ## Booking Status Values `booking_status` on a booking record is not something the requester or approver sets directly for most of its values. Most transitions are computed automatically by a backend process that re-evaluates every booking every couple of minutes against the current time and the vehicle's telemetry (ignition state, geofence entry/exit). A few values are set manually by a fleet manager acting in Fleetweb, not by that automatic process. ```mermaid stateDiagram-v2 [*] --> REQUESTED : Driver submits a request REQUESTED --> APPROVED : Manager approves (or client auto-approves) REQUESTED --> DECLINED : Manager declines REQUESTED --> EXPIRING_APPROVAL : Start time is under 1 hour away, still no decision EXPIRING_APPROVAL --> APPROVED : Manager approves before start time EXPIRING_APPROVAL --> DECLINED : Manager declines before start time EXPIRING_APPROVAL --> CANCELLED : Start time passes with no decision APPROVED --> CANCELLED : Vehicle never picked up within the grace period APPROVED --> ACTIVE : Vehicle picked up ACTIVE --> ACTIVE_ALMOST_LATE : Scheduled end time approaching ACTIVE --> ACTIVE_LATE : Scheduled end time passes, vehicle still out ACTIVE_ALMOST_LATE --> ACTIVE_LATE : Scheduled end time passes, vehicle still out ACTIVE --> RETURNED : Vehicle returned at or before end time ACTIVE_LATE --> RETURNED_LATE : Vehicle returned after end time APPROVED --> FORCE_TERMINATED : Manager force-ends the booking (Fleetweb) ACTIVE --> FORCE_TERMINATED : Manager force-ends the booking (Fleetweb) ACTIVE_LATE --> FORCE_TERMINATED : Manager force-ends the booking (Fleetweb) ``` | Value | Meaning | |-------|---------| | `BOOKING_STATUS_FREE` | Reserved value in the schema. No booking record returned by `GET /carpool/bookings` carries this status — it does not represent a state a real booking passes through. | | `BOOKING_STATUS_REQUESTED` | A driver has submitted a booking request. Awaiting a manager's approval or decline decision. | | `BOOKING_STATUS_APPROVED` | The booking is confirmed for its scheduled window — every department required to sign off has approved. This includes bookings approved automatically under a client's "Automatically approve new request" carpool setting: `is_approved` is `true` in that case too, but `approved_by` stays `null` because no manager actually took an approval action. | | `BOOKING_STATUS_DECLINED` | A manager declined the request. Unlike approval, decline doesn't need consensus — a single department manager declining is enough to move the whole booking to `DECLINED`, even if other departments haven't responded yet. | | `BOOKING_STATUS_CANCELLED` | The booking was cancelled — manually by the driver (only while still `REQUESTED` or `APPROVED`, not once picked up) or a manager (from any status), or automatically because the vehicle was never picked up. A `REQUESTED`, `EXPIRING_APPROVAL`, or `APPROVED` booking that passes its `start_ts` without being picked up is auto-cancelled once its client-configured grace period elapses (30 minutes after `start_ts` by default; some clients configure this relative to `end_ts` instead). | | `BOOKING_STATUS_ACTIVE` | The vehicle has been picked up and the booking is in progress, before its scheduled `end_ts`. What counts as "picked up" is configurable per client — ignition on, leaving a pickup geofence, key collection from a smart locker, or a manual action in Fleetweb. | | `BOOKING_STATUS_ACTIVE_ALMOST_LATE` | An early-warning state for an in-progress booking whose scheduled `end_ts` is approaching. Sits between `ACTIVE` and `ACTIVE_LATE` in the lifecycle — handle it as a valid value, but don't assume every booking passes through it before going late. | | `BOOKING_STATUS_ACTIVE_LATE` | The scheduled `end_ts` has passed and the vehicle has not yet been returned. | | `BOOKING_STATUS_RETURNED` | The vehicle was returned at or before the scheduled `end_ts`. | | `BOOKING_STATUS_RETURNED_LATE` | The vehicle was returned after the scheduled `end_ts`. | | `BOOKING_STATUS_EXPIRING_APPROVAL` | The booking is still awaiting a manager's decision (`REQUESTED`) and its scheduled `start_ts` is now less than one hour away. If no decision is made before `start_ts`, the booking is auto-cancelled. | | `BOOKING_STATUS_FORCE_TERMINATED` | A fleet manager manually ended the booking from Fleetweb — only possible while the booking is `ACTIVE`, `ACTIVE_ALMOST_LATE`, or `ACTIVE_LATE` (the vehicle must currently be checked out). This is not an automatic transition; Fleetweb's own confirmation prompt frames it for cases like an accident, breakdown, or the vehicle being towed, not routine returns. | ## Developer Considerations - The `ACTIVE` → `ACTIVE_ALMOST_LATE` → `ACTIVE_LATE` progression is graduated, not guaranteed — don't treat a booking going straight from `ACTIVE` to `ACTIVE_LATE` as unexpected or an error. - Don't recompute lateness yourself by comparing `returned_at` to `end_ts`. The API's `returned_at` prefers a site-location (geofence) timestamp over the ignition timestamp when both exist, and it can differ slightly from the timestamp actually used to decide `RETURNED` vs `RETURNED_LATE`. Trust the `booking_status` value for that determination. ## Setup Status: Vehicles and Drivers Both `GET /carpool/vehicles` and `GET /carpool/drivers` return a `setup_status` field, but the two use different enums (`SETUP_INCOMPLETE` / `READY` for vehicles, `SETUP_INCOMPLETE` / `ACTIVE_CARPOOL` for drivers) and different completeness rules — don't assume they're interchangeable. For vehicles, `SETUP_INCOMPLETE` means the vehicle is missing a department, category, default location, or license class. Which of those four are actually required is configurable per client: an account may not require all of them, so a vehicle can be `READY` without, for example, a department assigned, if that client hasn't turned department scoping on. For drivers, `ACTIVE_CARPOOL` requires the driver to be enabled for carpool booking (`can_book_carpool`) and to have at least one of `allow_system_auto_booking` or `allow_specific_vehicle_booking` enabled, plus any department/license requirements the client has turned on. A driver with `can_book_carpool: true` but both booking methods disabled still shows as `SETUP_INCOMPLETE`. ## Approval Fields: `is_approved`, `approved_by`, `declined_by` `approved_by` and `declined_by` are `null` whenever no manager has taken an approval action on the booking — including auto-approved bookings. Use `is_approved` and `booking_status` to determine the booking's approval state; use `approved_by`/`declined_by` only to find out whether a manager was the one who decided it. --- # Delivery Job Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/delivery-job-services This page explains how to create delivery jobs with the Fleet API and how to confirm whether submitted jobs were created successfully. ## Acronyms and Terms - **API**: Application Programming Interface. - **ERP**: Enterprise Resource Planning. - **HTTP**: Hypertext Transfer Protocol. ## Which Endpoint Should I Use? Use this mapping based on your job creation volume and feedback needs: - **High-volume job creation (batch uploads)**: - [Bulk Upload Delivery Jobs](https://developer.cartrack.com/docs/fleet-api/bulk-upload-delivery-jobs) - **Single or low-volume job creation (immediate response)**: - [Create a Delivery Job](https://developer.cartrack.com/docs/fleet-api/create-a-delivery-job) ## 1) Bulk Upload Delivery Jobs ### What It Means Submit multiple jobs in a single request when you need to push many deliveries from ERP or dispatch systems. ### Confirmation and Notifications The bulk upload service supports a `webhooks_url` field. After processing is completed, Cartrack sends a webhook callback so your system can confirm the upload outcome and reconcile what was created. For webhook setup, signature verification, and security guidance, see [Webhooks](/docs/fleet-api-general/webhook-notification). ### Purpose - Best option for scheduled or large delivery imports. - Gives operations teams a reliable confirmation flow instead of assuming all jobs were created. - Helps identify partial-creation scenarios quickly. ### Developer Considerations - Treat the request as an asynchronous flow. - Use webhook callbacks as the source of truth for completion status. - Compare your submitted jobs with callback results and trigger retry/escalation for jobs that were not created. ## 2) Create a Delivery Job ### What It Means Create one delivery job per request with immediate API feedback. ### Confirmation and Errors If the job cannot be created, the API returns a non-`200` HTTP status code together with an error message that explains the failure. ### Purpose - Best for interactive flows where users create one job at a time. - Failures are visible immediately and can be surfaced directly to support or dispatch users. ### Developer Considerations - Validate the HTTP response status for every request. - Handle non-`200` responses as explicit creation failures. - Log and return the API error message so operations teams can resolve data issues quickly. ## Recommended Integration Pattern 1. Keep a client-side reference for each submitted job (from ERP/dispatch). 2. Use bulk upload with `webhooks_url` for high-volume imports. 3. Track callback outcomes and reconcile expected vs created jobs. 4. Handle all non-`200` responses from single-job creation as failures. 5. Retry or escalate failed jobs through your internal support workflow. --- # Driver Identification Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/driver-identification-services This page explains how driver assignment works in the Fleet API, including driver tags, default drivers, mobile app assignment, and API linkage. ## Acronyms and Terms - **API**: Application Programming Interface. - **RFID**: Radio-Frequency Identification. ## Which Endpoint Should I Use? Use this mapping based on how you want to identify drivers for vehicles: - **Current driver snapshot across the fleet**: - [Get Vehicle's Status: location, fuel, odometer and more](https://developer.cartrack.com/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) - **Set or change a vehicle's default (fallback) driver**: - [Update a Vehicle's Details](https://developer.cartrack.com/docs/fleet-api/update-a-vehicles-details) - **Audit RFID driver tag reads over time**: - [Get Driver Tags Events](https://developer.cartrack.com/docs/fleet-api/get-driver-tags-events) - **Assign driver from a third-party integration (RFID-like behavior)**: - [Link Driver to a Vehicle](https://developer.cartrack.com/docs/fleet-api/link-driver-to-a-vehicle) - **Clear or inspect API-created linkages**: - [Unlink Driver from a Vehicle](https://developer.cartrack.com/docs/fleet-api/unlink-driver-from-a-vehicle) - [Retrieve Current Linkages](https://developer.cartrack.com/docs/fleet-api/retrieve-current-linkages) ## Driver Association Methods Drivers can associate to vehicles in multiple ways: 1. **Default driver on the vehicle**: - Persistent/fallback assignment. - Used when no temporary assignment is currently detected. 2. **RFID driver tag read in vehicle** (requires compatible fitment): - Driver tags in while ignition is ON. - Association is kept until ignition is OFF, or another driver tag is read and overrides it. 3. **Cartrack driver mobile app assignment**: - Driver assigns themselves in the app. 4. **Vehicle Driver Linkage API**: - Third-party system links a driver to a vehicle. - Useful when reproducing RFID-style behavior through integration. ## How Driver Tags Help Identify the Driver Driver tags provide an operational way to identify who is currently driving, without relying only on static/default vehicle ownership. - They capture a per-use driver context while ignition is ON. - They can override a previously assigned temporary driver during the same ignition cycle. - Their events can be audited historically through the driver tags events endpoint. This helps teams improve trip accountability and driver-level reporting for shared vehicles. ## Driver Resolution in Vehicle Status `/vehicles/status` is a snapshot service and returns the current driver context for each vehicle. - If an active temporary association exists (RFID tag flow or linkage API flow), that driver is shown as the current driver. - If no temporary association is active, the vehicle default driver is used as the fallback value. - RFID association is cleared at ignition OFF. ## Recommended Integration Pattern For most integrations: 1. Set and maintain default drivers as baseline ownership. 2. Use one temporary assignment flow for active-driver identification. 3. Poll vehicle status for operational snapshots. 4. Query driver tag events for historical audit and investigations. :::warning Integration Constraint Vehicle Driver Linkage endpoints should not be used together with other Cartrack driver-vehicle assignment services (for example, driver mobile app or driver tags) in the same operational flow. ::: --- # Fuel Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/fuel-services This page explains the fuel-related services in the Fleet API for both business and technical audiences. ## Acronyms and Terms - **API**: Application Programming Interface. - **ECU**: Engine Control Unit. The in-vehicle computer that controls and monitors engine operation. - **CAN bus**: Controller Area Network bus. The vehicle network used by electronic modules to exchange data. ## Fuel Concepts at a Glance - **Fuel consumed**: A cumulative value from the ECU that represents total fuel burned by the engine since a reference point. - **Fuel level**: Fuel quantity in the tank, read from an analog sensor or from the CAN bus. - **Fuel fills and estimated fuel used**: Events and usage periods inferred from fuel level trends over time. ## How to Check Sensor Availability Per Vehicle Before calling fuel endpoints, you can verify whether each vehicle has the required sensors by using: - [Get vehicles list](https://developer.cartrack.com/docs/fleet-api/get-vehicles-list) In the response, check `data.sensors.*`: - `data.sensors.fuel_canbus_consumed`: `true` when CAN bus fuel consumed data is available. - `data.sensors.fuel_canbus_level`: `true` when CAN bus fuel level data is available. - `data.sensors.fuel_analog_level`: `true` when an analog fuel level sensor is installed. - `data.sensors.electric_battery`: `true` when an electric battery sensor is installed. - `data.sensors.electric_charging`: `true` when an electric charging status sensor is installed. ### Fuel Service Mapping - **Fuel consumed services** require `data.sensors.fuel_canbus_consumed = true`. - **Fuel level services** require at least one of: - `data.sensors.fuel_canbus_level = true`, or - `data.sensors.fuel_analog_level = true`. - **Fuel fills / estimated fuel used** also depend on fuel level availability, so they require at least one of the two fuel level flags above. ### Example ```json { "data": { "vehicle_id": "123456", "sensors": { "fuel_canbus_consumed": true, "fuel_canbus_level": true, "fuel_analog_level": false, "electric_battery": false, "electric_charging": false } } } ``` ## 1) Fuel Consumed (ECU cumulative value) ### Definition `fuel_consumed` is the total volume of fuel consumed by the vehicle engine since a defined reference point (typically vehicle commissioning or factory release). It is a monotonically increasing cumulative value reported by the vehicle ECU. ### What It Is Not - Fuel currently in the tank. - Fuel used during one trip only. - Fuel used since ignition turned on. ### What It Is - Total engine fuel burned over the vehicle lifetime (from the ECU reference point). - Computed internally by the ECU from injection timing and flow models. - Independent of refueling events. ### Business Interpretation - Useful for long-term fuel performance and cost analysis. - Best suited for lifetime or long-period efficiency tracking. - Should not be used as a direct substitute for current tank fuel. ### Developer Interpretation - Treat as a cumulative counter. - Compute period usage by subtracting two valid readings. - Expect no value when the required capability is not enabled on the vehicle. ### Endpoints - Single vehicle: [Get a vehicle's fuel consumed sensor data](https://developer.cartrack.com/docs/fleet-api/get-a-vehicles-fuel-consumed-sensor-data) - Multiple vehicles: [Retrieve fuel consumed sensor data for multiple vehicles](https://developer.cartrack.com/docs/fleet-api/retrieve-fuel-consumed-sensor-data-for-multiple-vehicles) ### Availability Fuel consumed data requires the Cartrack fuel-consumed capability to be available for the vehicle. If the API returns no result, contact your Cartrack sales representative to confirm availability. ## 2) Fuel Level (analog sensor or CAN bus) ### Definition Fuel level is the measured amount of fuel in the tank at a point in time, read either from: - An analog fuel sensor. - The CAN bus. ### Business Interpretation - Useful for operational monitoring, fuel theft detection, and refill oversight. - Provides tank-state visibility rather than lifetime engine burn. ### Developer Interpretation - Treat as time-series telemetry. - Expect variation due to movement, slosh, sensor characteristics, and sampling. ### Endpoint - Vehicle history: [Get fuel level history for a vehicle](https://developer.cartrack.com/docs/fleet-api/get-fuel-level-history-for-a-vehicle) ### Availability Fuel level services require available fuel level readings for the vehicle. If no data is returned, contact your Cartrack sales account manager to confirm availability. ## 3) Fuel Fills and Estimated Fuel Used (derived from fuel level) ### Definition Cartrack identifies: - **Fuel fill periods** from increases in fuel level. - **Estimated fuel used periods** from decreases in fuel level. Both outputs are estimated from fuel level readings and require fuel level data availability. ### Business Interpretation - Helps reconcile refueling activity and consumption patterns. - Supports exception analysis (unexpected fills, unusual usage). ### Developer Interpretation - Treat these as derived analytics, not direct ECU counters. - Data quality depends on fuel level signal quality and coverage. ### Endpoints - Fuel fills (single vehicle): [Get fuel fills for a vehicle](https://developer.cartrack.com/docs/fleet-api/get-fuel-fills-for-a-vehicle) - Fuel fills (all vehicles): [Get fuel fills for all vehicles](https://developer.cartrack.com/docs/fleet-api/get-fuel-fills-for-all-vehicles) - Estimated fuel used (single vehicle): [Get fuel used estimate for a vehicle](https://developer.cartrack.com/docs/fleet-api/get-fuel-used-estimate-for-a-vehicle) ### Availability Fuel fills and estimated fuel used rely on fuel level readings. If no data is returned, confirm fuel level availability for the vehicle with your Cartrack sales account manager. --- # Mileage and Odometer Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/mileage-odometer-services This page explains how vehicle mileage and odometer data is tracked and reported through the Fleet API, covering how values are sourced, which endpoints to use for different use cases, and common integration pitfalls. ## Which Endpoint Should I Use? Use this mapping based on what you want to accomplish: | Goal | Endpoint | |------|----------| | Get total distance travelled over a period | [Get Odometer Reading](https://developer.cartrack.com/docs/fleet-api/get-the-odometer-reading) | | Get a breakdown of distance per trip | [Get All Trips](https://developer.cartrack.com/docs/fleet-api/get-all-trips) / [Get Trips by Registration](https://developer.cartrack.com/docs/fleet-api/get-trips-by-registration) | | Get the current odometer snapshot for a vehicle | [Get Vehicles Status](https://developer.cartrack.com/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) | ## 1) How Mileage is Tracked ### Data Source Cartrack trackers read odometer data directly from the vehicle's CAN bus where the hardware and vehicle support it. CAN bus odometer data reflects the vehicle's own internal mileage counter, making it the most accurate source. If CAN bus odometer data is not available for a vehicle, Cartrack calculates distance from GPS positions instead. The calculation method is transparent to you in the API — the fields are the same regardless of source. ### Units All odometer and distance values in the Fleet API are returned in **meters** unless otherwise stated. The vehicle status endpoint (`GET /vehicles/status`) is the only exception — it supports an optional `?odometer_in_km=true` parameter to return the value in kilometers. ### Flags to Watch Two flags on the odometer endpoint can indicate that values may be inconsistent over a queried period: | Flag | Meaning | |------|---------| | `odometer_reset` | The vehicle's odometer was reset during the period. This can happen when the tracker is reconfigured from GPS odometer to CAN odometer, or when the odometer is manually reset. Distance calculations across a reset period may not be reliable. | | `terminal_has_changed` | The physical Cartrack tracker in the vehicle was replaced during the period. The odometer counter restarts from a new baseline on the replacement device. | If either flag is `true` for a queried period, treat the distance values with caution and consider splitting the query into periods before and after the event. ## 2) Distance for a Period ### What It Means `GET /vehicles/{registration}/odometer` returns the odometer reading at the start and end of a specified time range, plus the total distance travelled in between. This is the recommended endpoint for any use case that needs accurate period-level distance, such as daily mileage reports or billing. ### Response Fields | Field | Description | |-------|-------------| | `start_odometer_value` | Odometer at the start of the queried period, in meters | | `end_odometer_value` | Odometer at the end of the queried period, in meters | | `distance` | Total distance travelled during the period, in meters | | `current_odometer_value` | The vehicle's current odometer reading at query time, in meters | | `latest_event_ts` | Timestamp of the most recent data received from the vehicle | ### Network Coverage Note The `latest_event_ts` field indicates when Cartrack last received data from the vehicle. If the vehicle is operating in an area with poor network coverage, data transmission may be delayed. If `latest_event_ts` is significantly earlier than your `end_timestamp`, the returned values may not yet reflect the full period. Query again later once coverage is restored. ### Developer Considerations - The time range is limited to a maximum of 31 days per request. - Check `odometer_reset` and `terminal_has_changed` before relying on the `distance` value for a period. - If you need distance across more than 31 days, issue multiple requests and sum the `distance` values for periods where neither flag is `true`. ## 3) Per-Trip Distance ### What It Means The trips endpoints return individual trip records, each with a `trip_distance` field and odometer readings at the start and end of the trip. This is useful when you need a journey-level breakdown rather than a period total. ### Response Fields (per trip) | Field | Description | |-------|-------------| | `trip_distance` | Distance covered during the trip, in meters | | `start_odometer` | Odometer at the beginning of the trip, in meters | | `end_odometer` | Odometer at the end of the trip, in meters | ### The Trip Boundary Pitfall :::warning Do not sum trip_distance for daily totals The trips endpoint returns any trip that overlaps the requested time window, including trips that started before `start_timestamp` or ended after `end_timestamp`. Those trips are returned in full — their full distance is included, not just the portion that falls within your window. Summing `trip_distance` across all returned trips will over- or under-count distance relative to your requested period. **For accurate daily or period distance totals, always use `GET /vehicles/{registration}/odometer` instead.** ::: ### Developer Considerations - Use trips data for per-journey breakdowns, driving behaviour reports, and start/end location analysis. - Do not derive total period distance by summing `trip_distance` — use the odometer endpoint. - The trips endpoint supports up to 31 days per request and returns paginated results. ## 4) Current Odometer Snapshot `GET /vehicles/status` includes an `odometer` field representing the vehicle's odometer reading as of its last update event. This is a point-in-time snapshot, not a period calculation. Use it for live fleet dashboards and current-state displays. Pass `?odometer_in_km=true` to receive the value in kilometers instead of meters. ## Recommended Integration Pattern 1. For **daily or period distance reporting**: use `GET /vehicles/{registration}/odometer` with `start_timestamp` and `end_timestamp` set to midnight boundaries. Check `odometer_reset` and `terminal_has_changed` before using the `distance` value. 2. For **per-trip mileage breakdown**: use `GET /trips/{registration}` and rely on `trip_distance` per individual trip record, not on a sum across trips. 3. For **live fleet odometer display**: poll `GET /vehicles/status` at your refresh interval and read the `odometer` field. 4. If values look inconsistent for a period, query `latest_event_ts` from the odometer endpoint to confirm whether all data has been received — coverage gaps can delay transmission. --- # Positions and Trip Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/positions-route-services This page explains how to retrieve vehicle positions and trip history with the Fleet API for both business and technical audiences. :::info Also known as The dense sequence of GPS points recorded along a trip is also commonly called a **waypoint list**, **GPS trail**, or **breadcrumb trail**. This page uses "breadcrumb" and "waypoint"/"trail" interchangeably to refer to the same data. ::: ## Acronyms and Terms - **API**: Application Programming Interface. - **GPS**: Global Positioning System. ## Which Endpoint Should I Use? Use this mapping based on the location-related data you need: - **All GPS positions / full trip point history**: - [Get events for one vehicle](https://developer.cartrack.com/docs/fleet-api/get-events-for-one-vehicle) - [Get events for all vehicles](https://developer.cartrack.com/docs/fleet-api/get-events-for-all-vehicles) - **Continuous tracking (near real-time fleet view)**: - [Get vehicles status, location, fuel, odometer and more](https://developer.cartrack.com/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) - **Trip start and end locations**: - [Get all trips](https://developer.cartrack.com/docs/fleet-api/get-all-trips/) - [Get trips by registration](https://developer.cartrack.com/docs/fleet-api/get-trips-by-registration) ## 1) All GPS Positions ### What It Means Retrieve historical position events over a period to reconstruct where a vehicle has been. ### Best Endpoints - Single vehicle: [Get events for one vehicle](https://developer.cartrack.com/docs/fleet-api/get-events-for-one-vehicle) - All vehicles: [Get events for all vehicles](https://developer.cartrack.com/docs/fleet-api/get-events-for-all-vehicles) ### Business Interpretation - Use for investigations, trip replay, proof of presence, and operational audits. - Best source when users ask for "all points" across a time window. ### Developer Interpretation - Treat events as historical telemetry points. - Query by time windows and paginate as needed. - For long periods, fetch in chunks to avoid very large responses. ### Recipe: Retrieving a GPS Breadcrumb Trail (Waypoints) for a Trip Use this recipe to get the dense GPS trail (waypoints) for a single trip, rather than every event type mixed together. 1. **Get the trip's time window.** Call [Get trips by registration](https://developer.cartrack.com/docs/fleet-api/get-trips-by-registration) (or [Get all trips](https://developer.cartrack.com/docs/fleet-api/get-all-trips/)) for the date range you care about, and read `start_timestamp`/`end_timestamp` off the trip you want: ``` GET /trips/{registration}?start_timestamp=2022-01-01 08:00:00&end_timestamp=2022-01-01 20:00:00 ``` ```json { "data": [ { "trip_id": 123456, "registration": "ABX123", "start_timestamp": "2022-01-01 08:12:00", "end_timestamp": "2022-01-01 08:49:00" } ] } ``` 2. **Fetch the periodic GPS pings for that window.** Call [Get events for one vehicle](https://developer.cartrack.com/docs/fleet-api/get-events-for-one-vehicle) using the trip's `start_timestamp`/`end_timestamp`, filtered to `terminal_event_type_id=2` (`PERIODIC_EVENT`). This excludes discrete events like ignition, geofence, or harsh braking, and returns just the dense position pings that make up the breadcrumb trail: ``` GET /vehicles/{registration}/events?start_timestamp=2022-01-01 08:12:00&end_timestamp=2022-01-01 08:49:00&terminal_event_type_id=2 ``` ```json { "data": [ { "event_id": 123456, "registration": "ABX123", "terminal_event_type_id": 2, "event_description": "PERIODIC_EVENT", "latitude": 1.320227, "longitude": 103.889653, "event_ts": "2022-01-01 08:12:02+00:00" }, { "event_id": 123457, "registration": "ABX123", "terminal_event_type_id": 2, "event_description": "PERIODIC_EVENT", "latitude": 1.320318, "longitude": 103.889801, "event_ts": "2022-01-01 08:12:34+00:00" } ] } ``` Each result is one waypoint on the trail. Points are typically spaced a few seconds to about a minute apart, depending on vehicle speed and hardware configuration. ## 2) Continuous Tracking (Near Real-Time) ### What It Means Show the latest known vehicle positions continuously, similar to a live fleet map. ### Best Endpoint - [Get vehicles status, location, fuel, odometer and more](https://developer.cartrack.com/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) ### Business Interpretation - Use for day-to-day live operations and dispatcher monitoring. - Best for "where is the vehicle now?" use cases. ### Developer Interpretation - Implement polling (for example every 10 to 30 seconds) to refresh latest states. - This is near real-time status polling, not a websocket streaming feed. - Combine with events endpoints when historical breadcrumb detail is required. ## 3) Full Trip History ### What It Means Depending on your use case, "trip history" can mean either: - Full breadcrumb points of a journey (also called waypoints or a GPS trail), or - Trip summaries with start and end locations. ### Endpoint Selection - For **full breadcrumb trip points (waypoints/trail)**: use the events endpoints, filtered to `terminal_event_type_id=2`. See [Retrieving a GPS Breadcrumb Trail (Waypoints) for a Trip](#recipe-retrieving-a-gps-breadcrumb-trail-waypoints-for-a-trip) above. - For **trip-level start and end locations**: - [Get all trips](https://developer.cartrack.com/docs/fleet-api/get-all-trips/) - [Get trips by registration](https://developer.cartrack.com/docs/fleet-api/get-trips-by-registration) ### Business Interpretation - Use trips for reporting and KPI-level trip analysis. - Use events when analysts need path-level detail. ### Developer Interpretation - Trips are summary records and should not be treated as complete trip-point datasets. - Build full trip replay from events data for the selected time interval. ## Recommended Implementation Pattern For most fleet applications: 1. Poll the vehicle status endpoint for current map state. 2. Query events endpoints for historical trip playback. 3. Query trips endpoints for trip reporting (start/end and trip context). --- # Vehicle Sensors Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/vehicle-sensors-services This page explains the vehicle sensor timeline available in the Fleet API, which sensors are supported, and how to retrieve historical sensor readings. ## Supported Sensors The sensor timeline endpoint supports the following sensor types: | Sensor | `filter[sensor]` value | Description | |--------|------------------------|-------------| | Fuel (CAN bus) | `FUEL` | Fuel level reported via the vehicle's CAN bus | | EV Battery | `EV_BATTERY` | State of charge for electric vehicles | | EV Charging Status | `EV_BATTERY_CHARGING_STATUS` | Whether the vehicle is currently charging | | EV Range | `EV_RANGE` | Estimated remaining range for electric vehicles | | EV Consumption | `EV_CONSUMPTION` | Energy consumption for electric vehicles | | Taxi | `TAXI` | Taximeter state, available for supported taxi operators | :::warning Sensor availability depends on the hardware installed in the vehicle and the sensors configured for the account. If a sensor is not configured, the endpoint returns no data for that vehicle. Contact your Cartrack account manager if you are unsure which sensors are active. ::: ## Which Endpoint Should I Use? Use the following endpoint to retrieve sensor timeline data for a single vehicle: - Single vehicle: [Get sensor timeline for one vehicle](https://developer.cartrack.com/docs/fleet-api/get-sensor-timeline-for-one-vehicle) ## How to Retrieve Sensor Timeline Data 1. Identify the vehicle registration and the sensor type you want to query. 2. Choose a time range. The range between `filter[start_timestamp]` and `filter[end_timestamp]` cannot exceed 31 days. 3. Call `GET /vehicles/{registration}/sensors/timeline` with `filter[sensor]`, `filter[start_timestamp]`, and `filter[end_timestamp]`. 4. Use the `value` and `raw_value` fields in each record to interpret the sensor state (see below). 5. Paginate through results using the `page` and `limit` parameters if the response spans multiple pages. ## Understanding the Response Each record in the response contains: | Field | Type | Description | |-------|------|-------------| | `sensor_id` | integer | Internal sensor type identifier | | `sensor_name` | string | Human-readable sensor name | | `sensor_no` | integer | Sensor number assigned to the vehicle | | `sensor_type` | string | `analog` or `digital` | | `event_ts` | string | Timestamp of the sensor reading | | `raw_value` | string | The literal value reported by the sensor hardware | | `value` | string | A numeric index mapped from `raw_value` (see country-specific notes below) | For most sensors, `raw_value` is the primary field to use. The `value` field is a positional index into a fixed mapping table defined per sensor type and is most relevant for sensors that report named states (such as the Taxi sensor). ## Country-Specific Notes ### Portugal — Taxi sensor Portuguese taxi operators use a taximeter sensor (`sensor_no` 901) connected to the Cartrack device. The taximeter sends state codes as strings; the API maps these to a numeric `value` index for consistency. | `value` | `raw_value` | Meaning | |---------|-------------|---------| | `0` | `DESLIGADO` | Taximeter off / out of service | | `1` | `LIVRE` | Free / available for hire | | `2` | `1` | Hardware-specific taximeter code | | `3` | `3` | Hardware-specific taximeter code | | `4` | `5` | Hardware-specific taximeter code | | `5` | `6` | Hardware-specific taximeter code | | `6` | `C` | Hardware-specific taximeter code | | `7` | `P` | Hardware-specific taximeter code | | `8` | `-` | Unknown / no data | `DESLIGADO` (off) and `LIVRE` (free) are the standard, well-understood states. The exact meaning of the hardware-specific codes (`1`, `3`, `5`, `6`, `C`, `P`) depends on the taximeter model and should be confirmed with the taximeter vendor. --- # Vehicle Temperature Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/vehicle-temperature-services This page explains how vehicle temperature data is reported through the Fleet API, covering the available temperature sources, which endpoints to use for different use cases, and how temperature alerts are delivered. ## Temperature Sources The Fleet API exposes two categories of temperature data: | Category | Fields | Where it comes from | |----------|--------|---------------------| | Cargo / cabin temperature probes | `temp1`, `temp2`, `temp3`, `temp4` | Up to four external temperature sensors wired to the Cartrack device, commonly used for refrigerated transport and cold chain monitoring | | Engine and unit temperatures | `water_temp` (coolant), `oil_temp`, `unit_temp` | Read from the vehicle's CAN bus (coolant and oil) or from the Cartrack device itself (unit temperature) | All temperature values are returned in **Celsius** as decimal numbers. A field is `null` when the corresponding sensor is not fitted or not reporting. :::warning Temperature sensor availability depends on the hardware installed in the vehicle. If no temperature probes are fitted, the `temp1` to `temp4` fields return `null`. Contact your Cartrack account manager if you are unsure which sensors are installed on your fleet. ::: ## Which Endpoint Should I Use? Use this mapping based on what you want to accomplish: | Goal | Endpoint | |------|----------| | Get the latest temperature reading for all vehicles | [Get Vehicles Temperature Data](https://developer.cartrack.com/docs/fleet-api/get-vehicles-temperature-data) | | Get historical temperature readings for a period | [Get Vehicles Temperature Data](https://developer.cartrack.com/docs/fleet-api/get-vehicles-temperature-data) | | Get temperature together with position, fuel, and odometer in one call | [Get Vehicles Status](https://developer.cartrack.com/docs/fleet-api/get-vehicles-status-location-fuel-odometer-and-more) | | Get engine coolant and oil temperature per event | [Get Events for All Vehicles](https://developer.cartrack.com/docs/fleet-api/get-events-for-all-vehicles) / [Get Events for One Vehicle](https://developer.cartrack.com/docs/fleet-api/get-events-for-one-vehicle) | | Retrieve triggered temperature alert notifications | [Get Alerts Notifications](https://developer.cartrack.com/docs/fleet-api/get-alerts-notifications) | ## 1) Dedicated Temperature Endpoint ### What It Means `GET /topics/vehicles/temperature` is the recommended endpoint for temperature monitoring. It returns the readings from the four temperature probes for all vehicles in the account, and operates in two modes: - **Latest mode**: omit both `filter[start_timestamp]` and `filter[end_timestamp]` to get the most recent temperature reading per vehicle, provided data was reported within the last 2 months. - **History mode**: provide a time range to get all readings within it. The range is limited to a maximum **24-hour** period. If only one timestamp is given, the other defaults to 24 hours before or after it. Use `filter[registration]` to restrict the response to a single vehicle. ### Response Fields | Field | Type | Description | |-------|------|-------------| | `vehicle_id` | integer | Cartrack vehicle identifier | | `registration` | string | The vehicle's registration | | `temp1` to `temp4` | number or null | Temperature reading from sensors 1 to 4, in Celsius | | `event_ts` | string | When the reading was recorded by the device | | `recieved_ts` | string | When the reading was received by Cartrack | If `recieved_ts` is significantly later than `event_ts`, the vehicle was likely in an area with poor network coverage and the data was transmitted with a delay. Keep this in mind when monitoring time-sensitive cold chain thresholds. ### Sub-User Access This endpoint supports Topic-Based Access Control. Grant the `TEMPERATURE` topic to a sub-user to give it the same temperature data access as the account administrator, without exposing the rest of the account. ### Developer Considerations - History queries are limited to 24 hours per request. For longer periods, issue multiple requests with consecutive windows. - Results are paginated: use the `page` and `limit` parameters to iterate through large fleets. - In latest mode, vehicles that have not reported temperature data in the last 2 months are not returned. ## 2) Temperature in Vehicle Status `GET /vehicles/status` includes the `temp1` to `temp4` fields as part of each vehicle's last known state, alongside position, ignition, fuel, and odometer. This is a point-in-time snapshot, not a history. Use it when you already poll vehicle status for a live dashboard and want to display current temperatures without an extra API call. ## 3) Engine Temperatures via Events The events endpoints (`GET /vehicles/events` and `GET /vehicles/{registration}/events`) return the full event stream from the vehicle. Each event includes the probe readings plus the engine-related temperatures: | Field | Description | |-------|-------------| | `temp1` to `temp4` | Temperature probes 1 to 4, in Celsius | | `water_temp` | Engine coolant temperature, in Celsius | | `oil_temp` | Engine oil temperature, in Celsius | | `unit_temp` | Internal temperature of the Cartrack device, in Celsius | Engine coolant and oil temperatures depend on CAN bus support for the vehicle model and return `null` when not available. ## 4) Temperature Alerts Temperature-related alerts are configured on the account (through Fleetweb or your Cartrack account manager) and can then be retrieved through the API: 1. Call [Get Alerts Notification Types](https://developer.cartrack.com/docs/fleet-api/get-alerts-notification-types) to list the alert types available on your account. Temperature-related types include `COOLANT_TEMPERATURE`, `ENGINE_TEMPERATURE`, `TEMPERATURE_DIAGNOSTIC`, and the geofence-scoped probe alerts `GEOFENCE_ALERTS_TEMP1_HIGH_WITH_IGNITION_ON` to `GEOFENCE_ALERTS_TEMP4_LOW_WITH_IGNITION_ON` (a high and a low variant per probe). 2. Call [Get Alerts Notifications](https://developer.cartrack.com/docs/fleet-api/get-alerts-notifications) with `filter[alert_type]` set to the relevant type to retrieve the triggered notifications for a period (limited to 31 days per request). :::info Creating temperature alerts through the API is not currently supported. The alert creation endpoints cover other alert types (geofence, ignition, and [PTO and panic sensors](https://developer.cartrack.com/docs/fleet-api/create-sensor-alert)); temperature thresholds are configured on the account itself. ::: ## Recommended Integration Pattern 1. For **cold chain monitoring**: poll `GET /topics/vehicles/temperature` in latest mode at your refresh interval, and compare `temp1` to `temp4` against your thresholds. Check `event_ts` to make sure the reading is recent before acting on it. 2. For **temperature history and auditing**: pull `GET /topics/vehicles/temperature` with consecutive 24-hour windows and store the readings on your side. 3. For **live fleet dashboards**: read the `temp1` to `temp4` fields from `GET /vehicles/status`, which you likely already poll for positions. 4. For **threshold breach notifications**: configure temperature alerts on the account, then poll `GET /alerts/notifications` filtered by the temperature alert types. 5. For **engine health monitoring**: use the events endpoints and track `water_temp` and `oil_temp` over time. --- # Vehicle Events Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/vehicles-events-services This page explains the vehicle events available in the Fleet API and how to retrieve them. ## Acronyms and Terms - **API**: Application Programming Interface. - **GPS**: Global Positioning System. ## Which Endpoint Should I Use? Use these endpoints to retrieve event data: - Single vehicle: [Get events for one vehicle](https://developer.cartrack.com/docs/fleet-api/get-events-for-one-vehicle) - All vehicles: [Get events for all vehicles](https://developer.cartrack.com/docs/fleet-api/get-events-for-all-vehicles) ## How to Retrieve Vehicle Events 1. Choose whether you need data for one vehicle or all vehicles. 2. Query the events endpoint for the required time range. 3. Use `terminal_event_type_id` and `event_description` to identify the event type. 4. Map event IDs in responses using the table below. ## Vehicle Event Types :::warning Important Disclaimer The events reported depend on the hardware installed in the vehicle, third-party data availability, and the installation procedure. If you have any questions, please request clarification from your Cartrack account manager during onboarding. ::: _Interactive content, see https://developer.cartrack.com/docs/fleet-api-general/services/vehicles-events-services_ --- # Vision Services Source: https://developer.cartrack.com/docs/fleet-api-general/services/vision-services This page explains how to interact with Cartrack Vision cameras through the Fleet API, covering video clip requests, status tracking, livestreaming, and custom camera uploads. :::warning Vision API subscription required This service is available exclusively for accounts with the **Cartrack Vision API** option enabled. If you receive HTTP 403, contact your Cartrack customer success manager to enable access. After activation, allow 5 to 10 minutes for the configuration to propagate before making API calls. ::: ## Which Endpoint Should I Use? Use this mapping based on what you want to accomplish: | Goal | Endpoint | |------|----------| | Request a video clip from a vehicle camera | [Create Video Requests](https://developer.cartrack.com/docs/fleet-api/create-video-requests) | | Retrieve downloaded video clips | [Get Video Requests](https://developer.cartrack.com/docs/fleet-api/get-video-requests) | | Check the processing status of video requests | [Get Video Requests Status](https://developer.cartrack.com/docs/fleet-api/get-video-requests-status) | | Get a real-time livestream link for a vehicle | [Video Livestream Requests](https://developer.cartrack.com/docs/fleet-api/video-livestream-requests) | | Check whether a vehicle's cameras are currently online | [Get Vision Camera Online Status](https://developer.cartrack.com/docs/fleet-api/get-vision-camera-online-status) | | Upload a single video from a custom camera device | [Upload Video](https://developer.cartrack.com/docs/fleet-api/upload-video) | | Upload multiple videos from custom camera device(s) | [Bulk Upload Videos](https://developer.cartrack.com/docs/fleet-api/bulk-upload-videos) | ## 1) Requesting and Retrieving Video Clips ### How It Works A video request is not an immediate download. When you submit a request, you are instructing the camera device to locate the requested footage on its local storage and upload it to the Cartrack server. The clip only becomes available to download once the camera has completed that upload. This means the full flow depends on two things outside the API's control: the camera must be online with sufficient network coverage, and the requested footage must still exist on the device's local storage. If the camera has poor or no connectivity at the time of the request, it will retry automatically and the clip will remain in Pending until it can be fully uploaded. ### How Video Requests Are Created Video requests can be created from three different sources. `GET /vision/videos/requests` returns all requests regardless of origin. You will see requests you did not create via the API. | Source | How | |--------|-----| | Fleet API | `POST /vision/videos/requests` (programmatic, from your integration) | | Camera AI | Automatic. The DVR triggers a request when it detects a configured event (fatigue, distraction, cell phone usage, etc.) | | Fleetweb | Manual. A fleet operator requests a clip through the web portal | ### Clip Lifecycle After a request is created, its `status_id` progresses through several states. The `url` field is `null` until the clip reaches status `3` (Complete). ```mermaid sequenceDiagram participant Origin as API / Fleetweb / Camera AI participant API as Fleet API participant Cam as DVR Camera Origin->>API: Create video request API-->>Origin: status_id: 1 (Pending), url: null loop Poll GET /vision/videos/requests Origin->>API: Check status_id API-->>Origin: status_id: 1 or 2, url: null end Note over Cam: Camera comes online with network coverage API->>Cam: Request footage segment Cam->>API: Upload footage API-->>API: status_id → 3, url populated Origin->>API: GET /vision/videos/requests API-->>Origin: status_id: 3 (Complete), url: "https://..." ``` Key status codes to handle in your integration: | status_id | Label | Meaning | |-----------|-------|---------| | 1 | Pending | Request queued, waiting for camera to upload | | 2 | In Progress | Camera is uploading the footage | | 3 | Complete | Footage is ready. `url` is populated | | 5 | Does Not Exist | Requested time range not found on camera storage | | 6 | Timeout | Camera did not respond within the allowed window | ### Downloading the Clip Once a request reaches `Complete`, its `url` is a ready-to-use link to the footage. The URL is **durable** - fetch it immediately, or store it in your own system and retrieve it later. Treat the URL as **opaque**: do not parse it or depend on its host or path structure. If your application plays the clip back in a browser rather than just downloading it, the same origin restriction described under [Browser Playback and CORS](#browser-playback-and-cors) applies. Fetch the clip through your own backend and re-serve it to your frontend rather than pointing browser JS at the `url` directly. ### Limitations **Network coverage.** The camera must be online and have sufficient network connectivity to upload footage. If the vehicle is in a low-coverage area when the request is placed, it will remain in Pending until coverage is restored. There is no guarantee of when, or whether, that happens. **FIFO local storage.** DVR cameras store footage locally with a fixed capacity. When storage is full, the oldest footage is overwritten. If you place a request for footage from several days ago and the camera has been recording continuously since, that segment may no longer exist on the device. This results in a `Does Not Exist` (status 5) or `Timeout` (status 6) outcome. Request footage as soon as possible after the event of interest. ### Polling Pattern To track a clip from creation to completion, poll `GET /vision/videos/requests` and inspect the `status_id` field on each request. Poll at a reasonable interval; every 30 to 60 seconds is sufficient. Stop polling when `status_id` reaches a terminal state (`3`, `5`, or `6`). `GET /vision/videos/status` is a static reference table that returns the full list of status codes and their descriptions. It is not a per-request status endpoint and does not need to be polled. ## 2) Video Livestream ### What It Means Request a real-time livestream link for a specific vehicle. The API returns a URL your application can use to display a live camera feed. ### Response The response is an HTTP `200` with two arrays: `data` (cameras that started streaming) and `failed_cameras` (cameras that could not, each with a `status` and a human-readable `message`). A request can partially succeed, so **`200` does not mean every camera is streaming** - always read both arrays. Even when every requested camera fails, the HTTP status is still `200` with an empty `data` array; a non-`200` means the request itself failed, not an individual camera. Each entry in `data` carries an `is_hls` flag: `true` when its `url` is an HLS playlist, `false` for a WebSocket stream. The streaming format is fixed per account, so all cameras in a response share the same `is_hls` value. For HLS streams, each `data` entry also includes an `expires_at` timestamp for when that URL stops working; request a fresh livestream before then to keep watching. WebSocket entries have `expires_at: null`. Treat the `url` as opaque and do not depend on its host or path. ### Error: Camera Not Online If the vehicle's DVR camera is currently offline, the API returns HTTP `409`: ```json HTTP 409 {"error":{"code":409,"message":"Livestream unavailable: Digital Video Recorder is offline"}} ``` This indicates the camera device itself is unreachable; the Fleet API is functioning normally. A `409` here is a device-state conflict, not a server error, so **do not retry it in a loop.** Surface it to the user as a camera availability issue and let them decide when to retry. To avoid the `409` altogether, check the camera's current state with `GET /vision/status` before requesting a livestream. See [Camera Online Status](#4-camera-online-status). ### Developer Considerations - Livestream links are short-lived. For HLS streams, `expires_at` tells you exactly when a URL stops working; request a fresh one before then. Do not cache links across sessions, and treat them as opaque (do not depend on host or path). - The link is tied to the vehicle registration passed in the path (`/vision/livestream/{registration}`). - If a vehicle has multiple cameras, the response may include multiple stream links in `data`, and any that could not start in `failed_cameras`. - Handle `409` from this endpoint as a camera state issue, not a server failure. Do not retry it in a loop; let the user trigger the retry manually. ### Browser Playback and CORS The livestream `url` is meant to be relayed through your own backend, not handed directly to browser JavaScript (hls.js, Video.js, a `