Configure your credentials, confirm your account access and read your first device. You will use a device ID from the inventory response in a second request.
A terminal with cURL, or Python 3 for the server example below. The reference also includes JavaScript examples for Node.js 22 or newer.
An API token issued to your company by Barq and an active account/subscription. Request access through the button in the header.
At least one assigned device to complete the status read. Start with the inventory to discover its Barq ID.
These examples use standard HTTP tools. Browser Tracking sign-in and API-token authorization are separate; signing in to Tracking does not authorize an API request.
Configure Your API Token
Save the token as BARQ_API_TOKEN in your server’s environment or secret settings. For this quickstart, use Bash and enter it at a hidden prompt:
Keep the token out of source control, frontend bundles and request URLs.
Confirm Your Access and Limits
Read your credential’s permissions and your company’s actual shared quotas. A successful read returns HTTP 200. A read-only token does not grant command or asset-management access.
This response does not include token expiry or your history-access cutoff. Confirm those details with Barq.
Read Your Assigned Devices
Start with the inventory, follow each next link until it is null, and copy a returned device id. Send your Bearer header only to the Barq API origin. The base path /api/v1/ groups the endpoints; use a complete endpoint for your request.
Look for HTTP 200 and a JSON object containing count, next, previous and results. An empty results array means no devices are available to this credential; contact Barq to check assignments.
Use the Device ID in Your Next Request
Paste an id from your own inventory when prompted. This is a Barq UUID, not a serial number or vehicle plate.
Bash + cURL · Device Status
read -r -p "Device ID from results: " DEVICE_ID
curl --include --get "https://api.barqglobal.com/api/v1/devices/$DEVICE_ID/status/" \
--header "Authorization: Bearer $BARQ_API_TOKEN"
Confirm HTTP 200 and the same device id in the response. Check report timestamps: a successful API response can contain older device telemetry, and null means unavailable or unverified.
Connect Your Application
Use the Python example below, or copy a language example from the Devices reference. Keep credentials in your backend. Check the HTTP status before processing data, and follow the pagination and polling limits.
Run Your First Python Request
Save this as quickstart.py and run python3 quickstart.py in the same terminal where you exported the token. It uses Python’s standard library.
Python 3 · quickstart.py
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://api.barqglobal.com/api/v1/devices/",
headers={"Authorization": "Bearer " + os.environ["BARQ_API_TOKEN"]},
)
with urlopen(request, timeout=20) as response:
print("HTTP", response.status)
data = json.load(response)
print(json.dumps(data, indent=2))
If a Request Fails
401: check for an invalid, revoked or expired token.
403: check credential permissions, account/subscription access and any history boundary.
404: check the endpoint path and use an assigned device ID. Opening /api/v1/ alone returns 404.
429 or 503: pause before retrying reads; respect the response’s Retry-After header when present.
The API hostname serves your company’s live account data. Documentation response examples are illustrative. Device commands require separate permissions and a deliberate action.
Request the device status or position endpoint with your issued Bearer token. Poll each device at most once every 60 seconds. Keys share the customer budget of 240 reads and 30 report reads per minute. Check recorded_at and received_at to distinguish device time from data receipt.
If a read returns 429 or 503, pause until Retry-After expires. Keep missing readings and unconfirmed position sources as unavailable. Do not turn missing telemetry into a zero or an online status.
List Your Devices
Each device has a Barq id. Use it in every device read.
Check the device’s command capabilities and current assignment first. For each deliberate command intent, create a fresh UUID Idempotency-Key and retain the command ID returned by the API.
Acceptance means the request was acknowledged; physical execution remains unverified. Read the saved receipt within the rate limits. Pending commands block further submissions until delivery is resolved. Never automatically resubmit an uncertain command.
Build the range in the customer’s IANA timezone, then send ISO 8601 timestamps with offsets. Start is included and end is excluded. Split into windows no longer than 24 hours; daylight-saving days may need an extra window.
Fetch windows sequentially, respecting Retry-After. Combine and sort points by recorded_at, remove exact duplicates and draw coordinates as latitude, longitude. Do not bridge missing positions or imply GPS accuracy when the source is unconfirmed. Actual travelled distance may differ.