Skip to main content

Overview

V2 consolidates trip replay into a single paginated endpoint. Each TripDto covers one continuous movement segment:
FieldDescription
distanceTrip distance in km
durationTrip duration as "hh:mm:ss" (e.g. "00:28:14")
startAddress / endAddressReverse-geocoded start and end addresses
startTimeUser / endTimeUserTrip start/end formatted in the user’s configured timezone
encodedGoogle Polyline Algorithm–encoded path string
urlReady-to-use Google Static Maps URL for a thumbnail
pointsArray of waypoints with speed, direction, ignition, fuel, and odometer
V2 uses a single GET /api/v2/replay/{id} endpoint for all replay requests. The V1 distinction between GetReplayUserTime and GetReplay (UTC vs. user time) no longer applies — V2 always returns both timeUtc and timeUser on each point.

Step 1 — Request a date range

Fetch trips for vehicle 1000 over one week. Pass from and to as ISO 8601 UTC strings:
curl -s \
  "https://api.telemax.com.au/api/v2/replay/1000?from=2025-05-01T00:00:00Z&to=2025-05-08T00:00:00Z&page=1&pageSize=20" \
  -H "Authorization: Bearer YOUR_TOKEN"

Step 2 — Inspect the response

The response is a paginated envelope. Each element in items is a TripDto:
{
  "items": [
    {
      "id": 103925,
      "distance": 15.6,
      "duration": "01:25:00",
      "startAddress": "123 Main St, Sydney NSW 2000",
      "endAddress": "789 Park Ave, Sydney NSW 2021",
      "startTimeUser": "05/01/2025 08:00:00",
      "endTimeUser": "05/01/2025 09:25:00",
      "encoded": "mfp_IvhkeLh@d@pFzBrA`@v@eBhA",
      "url": "https://maps.googleapis.com/maps/api/staticmap?path=enc:mfp_IvhkeLh@d@pFzBrA`@v@eBhA",
      "points": [
        {
          "id": 2505020,
          "lat": -33.8688, "lng": 151.2093,
          "timeUtc": "2025-05-01T08:00:00",
          "timeUser": "2025-05-01T18:00:00",
          "speed": 0, "direction": 142,
          "ignition": true, "odo": 45290.0,
          "fuelLevel": null, "fuelVolume": null
        }
      ]
    }
  ],
  "currentPage": 1,
  "numberOfPages": 3,
  "totalResults": 47,
  "lastResultIndex": 19
}
Point fields:
FieldTypeDescription
lat / lngnumberGPS coordinates
timeUtcstringWaypoint timestamp (UTC, no Z suffix)
timeUserstringWaypoint timestamp in user’s timezone
speednumberSpeed at this point (km/h)
directionnumberHeading in degrees (0–359)
ignitionbooleanIgnition state at this point
odonumberOdometer reading (km)
fuelLevelintegerFuel level (%)
fuelVolumenumber | nullFuel volume (litres)

Step 3 — Decode the encoded polyline

The encoded field uses the Google Polyline Algorithm format, supported by all major mapping SDKs.
# pip install polyline
import polyline

def decode_trip(trip):
    coords = polyline.decode(trip["encoded"])  # list of (lat, lng) tuples
    print(f"Trip {trip['id']}: {len(coords)} decoded points, "
          f"{trip['distance']:.1f} km, {trip['duration']}")
    return coords

for trip in trips:
    coords = decode_trip(trip)

Step 4 — Render on a map

// Assumes Leaflet map initialised as `map`
import polyline from "@mapbox/polyline";

for (const trip of trips) {
  const coords = polyline.decode(trip.encoded);

  // Draw the route
  L.polyline(coords, { color: "#0075FF", weight: 3 }).addTo(map);

  // Start marker
  L.marker(coords[0])
    .bindPopup(`<b>Start</b><br>${trip.startAddress}<br>${trip.startTimeUser}`)
    .addTo(map);

  // End marker
  L.marker(coords[coords.length - 1])
    .bindPopup(`<b>End</b><br>${trip.endAddress}<br>${trip.endTimeUser}`)
    .addTo(map);
}

// Fit map to all trips
const allCoords = trips.flatMap(t => polyline.decode(t.encoded));
if (allCoords.length) map.fitBounds(allCoords);

Fetching all pages

For long date ranges, iterate through all pages:
Python
def fetch_all_trips(vehicle_id: int, from_dt: str, to_dt: str, token: str) -> list:
    trips = []
    page = 1
    while True:
        r = requests.get(
            f"https://api.telemax.com.au/api/v2/replay/{vehicle_id}",
            params={"from": from_dt, "to": to_dt, "page": page, "pageSize": 20},
            headers={"Authorization": f"Bearer {token}"},
        )
        r.raise_for_status()
        data = r.json()
        trips.extend(data.get("items", []))
        if page >= data.get("numberOfPages", 1):
            break
        page += 1
    return trips

Google Static Maps thumbnail

The url field is a pre-built Google Static Maps URL. Use it server-side to generate a trip thumbnail without decoding the polyline:
Python
import requests

for trip in trips:
    thumb_url = trip["url"] + "&size=400x200&key=YOUR_GMAPS_KEY"
    img_data = requests.get(thumb_url).content
    with open(f"trip_{trip['id']}.png", "wb") as f:
        f.write(img_data)

Gotchas

  • Distance unit: distance is in kilometres in V2 (V1 used metres).
  • Duration format: duration is "hh:mm:ss" in V2, not ISO 8601 PT... format.
  • Single endpoint: V2 has one replay endpoint. Both UTC and user-time fields are always returned on each point — no need to choose between GetReplay and GetReplayUserTime.
  • encoded format: Google Polyline Algorithm. If your decoder produces invalid coordinates, confirm the encoding with your Telemax contact.