Toll Roads

Toll Roads data for developers

Read-only JSON for South African toll and fuel prices. The API is available on request: you need an API key, issued free on request.

Getting a key

Ask through the contact form or email info@tollroads.co.za. Tell us your name, your site or app, what you'll use the data for and roughly how often you'll call the API.

Each key allows 100 requests a day by default, counted per UTC day. Higher limits are available on request. Keep your key on your server: anyone can read a key in browser code, and their requests would count against your limit.

Endpoints

GET /api/v1/tollsThe full tariff: version, effective date, sources and every plaza.
GET /api/v1/tolls/versionJust the version and effective date, for a cheap check.
GET /api/v1/fuelThe regulated fuel prices: grid of grade by inland and coast, in rand per litre.

Every response carries Access-Control-Allow-Origin: *, an ETag equal to the version, and Cache-Control: private, max-age=3600. Send the ETag back in If-None-Match and an unchanged dataset returns 304 with no body.

Sending your key

Send the key in the X-API-Key header on every request. Authorization: Bearer <key> works too. Keys in the query string are not accepted, because URLs end up in logs.

curl -H "X-API-Key: tr_live_..." https://tollroads.co.za/api/v1/tolls/version

Every request with a valid key carries these headers:

X-RateLimit-LimitYour key's requests per day.
X-RateLimit-RemainingRequests left today.
X-RateLimit-ResetWhen the count starts again: the next 00:00 UTC, in epoch seconds.

Every request with a valid key counts toward the limit. A 304 counts too. The version endpoint is the cheap way to poll: check it, and fetch the full data only when the version changes. Requests to unknown /api/v1 paths also count.

Errors

A missing, unknown or revoked key gets 401:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="tollroads.co.za"

{ "error": "api_key_required" }   (no key sent)
{ "error": "invalid_api_key" }    (unknown or revoked key)

Over the daily limit you get 429, with Retry-After set to the seconds until 00:00 UTC:

HTTP/1.1 429 Too Many Requests
Retry-After: 3600
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1796169600

{ "error": "daily_limit" }

Toll tariff

Prices are in rand per vehicle class (1 to 4). A plaza with "verified": false has a price not yet confirmed. directions is "both" or an array of the charged bearings in degrees.

{
  "version": "db7e44be255cb75d",
  "effective": "2026-03-01",
  "sources": [{ "name": "SANRAL toll tariffs from 1 March 2026", "url": "https://www.nra.co.za/..." }],
  "plazas": [
    {
      "id": "example-plaza",
      "name": "Example plaza",
      "road": "N1",
      "operator": "SANRAL",
      "type": "mainline",
      "lng": 28.0,
      "lat": -26.0,
      "directions": "both",
      "prices": { "1": 50.5, "2": 100, "3": 150, "4": 200 },
      "verified": true,
      "source": "SANRAL poster, 1 March 2026"
    }
  ]
}

Version check

{ "version": "db7e44be255cb75d", "effective": "2026-03-01" }

Fuel prices

The numbers above are placeholders. Real responses carry the current regulated prices. source is one of aa, gov, manual or default.

{
  "version": "0123456789abcdef",
  "effective": "2026-12-03",
  "month": "December 2026",
  "source": "aa",
  "grid": {
    "petrol93": { "inland": 0, "coast": 0 },
    "petrol95": { "inland": 0, "coast": 0 },
    "diesel50": { "inland": 0, "coast": 0 },
    "diesel500": { "inland": 0, "coast": 0 }
  }
}

Using it

At build time

import { writeFile } from 'node:fs/promises';

// Run at build time, then ship the saved copy with your site.
const res = await fetch('https://tollroads.co.za/api/v1/tolls', {
  headers: { 'X-API-Key': process.env.TOLLROADS_API_KEY },
});
if (!res.ok) throw new Error('Toll data unavailable: ' + res.status);
await writeFile('data/tolls.json', await res.text());

Live, with a stored copy

// On your server: check the cheap version endpoint, fetch the full
// tariff only when it has changed, and keep serving the stored copy.
let stored = { version: null, data: null };

async function loadTolls() {
  const headers = { 'X-API-Key': process.env.TOLLROADS_API_KEY };
  try {
    const v = await fetch('https://tollroads.co.za/api/v1/tolls/version', { headers });
    if (v.ok && (await v.json()).version !== stored.version) {
      const res = await fetch('https://tollroads.co.za/api/v1/tolls', { headers });
      if (res.ok) {
        const data = await res.json();
        stored = { version: data.version, data };
      }
    }
  } catch {}
  return stored.data;
}

Attribution and wording

Please credit tollroads.co.za where you show the data. Always show the tariff effective date, call the amounts an estimate, and link the official sources listed in the response. The data is a guide, not an official quote.

Update schedule

Toll tariffs change on 1 March each year. Fuel prices change monthly, when the new regulated price takes effect.

Versioning

This is version 1. Fields may be added, but they will not be renamed or removed. A breaking change will be published under /api/v2/, and /api/v1/ will keep working for a while after that.