oslew docs
Console
Menu

Operator feeds

Two routes write rather than read. /v1/traffic reweights the driving network from a traffic feed, so live routes reflect the roads as they are now; /v1/transit_rtapplies a GTFS-Realtime feed, so departures andjourneys carry delays and skipped stops. Both belong to theoperator product, which is on the Enterprise plan only and has its own rate-limit bucket. Each has a GET for its status, a POST to apply a feed and a DELETE to drop it.

What to do about it, until feed state is shared across a fleet:

  • Re-apply on a schedule. Every POST is a complete snapshot that replaces the last one, so sending the current feed again is harmless and puts it back on a pod that restarted. Traffic and realtime feeds go stale within minutes anyway.
  • Trust the answer, not the status. A route says which weights answered it inengine — live/… or base/… — and a departures answer carries the realtime feed's timestamp in live, or null. Check those on the answers that matter rather than assuming a POST reached the pod that answered.
  • Do not treat a feed as durable. Keep the source of truth in your own system and post from it.

Neither route is an MCP tool, on purpose: they change what a pod answers, and nothing an agent can call is allowed to. See AI agents over MCP.

Live traffic

Status

curl
curl "https://api.oslew.com/v1/traffic" \
  -H "Authorization: Bearer $GEO_API_KEY"
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.traffic()
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.traffic();
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 19
ratelimit-reset: 1

{
  "applied": false,
  "version": 0,
  "edges_updated": 0,
  "applied_at": null,
  "engine": "none",
  "took_us": 0
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

FieldIs
appliedWhether live weights are in force on this pod.
versionThis pod's feed count, from 1; 0 before any feed.
edges_updatedRoad edges whose travel time differs from the release's.
applied_atUnix seconds the feed was applied, or null.
enginenone, dijkstra while the fast hierarchy is being rebuilt, then hierarchy.
took_usServer time for this request, in microseconds.

Applying a feed

A JSON body with an edge list. Each entry names a road by a point on it:

FieldIs
atRequired. lat,lon on the road. It snaps to the nearest road edge, searching out to about 9 km.
toOptional. lat,lon further along. With it, the entry covers every edge of the route from at to to over the release's network, in both directions. Without it, the entry covers the one edge at snapped to, both ways if the road is two-way.
speed_kmhThe speed now. The edge's time becomes its length at that speed.
factorOr a multiplier on the release's time: 2 is twice as slow, 0.5 twice as fast. Used when speed_kmh is absent; when both are given, the speed wins.
curl
curl -X POST "https://api.oslew.com/v1/traffic" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"edges":[{"at":"19.4270,-99.1677","to":"19.4318,-99.1580","factor":3}]}'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.post_traffic(
    {
    "edges": [{"at": "19.4270,-99.1677", "to": "19.4318,-99.1580", "factor": 3}],
},
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.post_traffic({
  edges: [{ at: "19.4270,-99.1677", to: "19.4318,-99.1580", factor: 3 }],
});
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 18
ratelimit-reset: 1

{
  "applied": true,
  "version": 1,
  "edges_updated": 39,
  "applied_at": 1790259566,
  "engine": "dijkstra",
  "took_us": 23312
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

One entry with to covered 39 edges of Paseo de la Reforma. The answer came back withengine: "dijkstra": live routes are answered at once, by Dijkstra's algorithm over the reweighted network, while the contraction hierarchy that makes routing fast is rebuilt on a background thread. When it is ready it is swapped in and the status says hierarchy — unless a newer feed arrived meanwhile, in which case that one's rebuild wins. A route asked for with traffic=live straight after the feed:

curl
curl -G "https://api.oslew.com/v1/route" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'from=19.4406,-99.2047' \
  --data-urlencode 'to=19.4326,-99.1332' \
  --data-urlencode 'traffic=live' \
  --data-urlencode 'geometry=false'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.route(
    "19.4406,-99.2047",
    "19.4326,-99.1332",
    geometry=False,
    traffic="live",
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.route("19.4406,-99.2047", "19.4326,-99.1332", { geometry: false, traffic: "live" });
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1

{
  "from": [
    19.4406,
    -99.2047
  ],
  "to": [
    19.4326,
    -99.1332
  ],
  "snapped_from": {
    "from": 394836,
    "to": 394840,
    "frac": 0.05159010871941542,
    "lat": 19.440242113128892,
    "lon": -99.20471337400338,
    "distance_m": 39.819960107330104,
    "time_ds": 28,
    "len_m": 39,
    "two_way": false
  },
  "snapped_to": {
    "from": 355496,
    "to": 355490,
    "frac": 0.16199866758190418,
    "lat": 19.43200133133587,
    "lon": -99.13329035902773,
    "distance_m": 67.23995201279342,
    "time_ds": 110,
    "len_m": 92,
    "two_way": false
  },
  "found": true,
  "distance_m": 9269,
  "duration_s": 695.2,
  "nodes": 165,
  "settled": 65350,
  "geometry": [],
  "engine": "live/dijkstra",
  "provenance": {
    "name": "overture-transportation",
    "release": "2026-08-19.0",
    "license": "ODbL-1.0"
  },
  "took_us": 7120
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

engine: "live/dijkstra" says the live weights answered, by the slower algorithm. Without a feed on that pod the same request answers from the release and says base/hierarchy, silently — which is whyengine is the field to check. Live traffic covers asking for live routes, matrices and isochrones.

  • A POST replaces the whole live state. Edges it does not mention go back to the release's times. Send every slow road in one body, not one road per request.
  • One bad entry refuses the whole feed with a 400: an at or to with no road within about 9 km, a coordinate that does not parse, or a to the network cannot reach from at.
  • Live weights are the driving network's. Walking, cycling and rail do not take them.
  • The body is read as JSON whatever its Content-Type says, and may be at most 2 MB.

TomTom and HERE bodies

With ?format=tomtom or ?format=here the body is the vendor's own flow JSON, exactly as its API returned it, converted to edges here. Each consecutive pair of points along a vendor segment becomes one entry with at, to and the segment's speed.

formatBodyRead from it
tomtomTomTom Traffic API, Flow Segment DataflowSegmentData.currentSpeed (km/h) and flowSegmentData.coordinates.coordinate[] (latitude, longitude).
hereHERE Traffic API v7, flowFor each of results[]: currentFlow.speed (m/s, converted to km/h) and the points oflocation.shape.links[]. A result with no speed — a closed road — becomes a factor of 10.

A HERE response covers many segments and applies in one request. A TomTom Flow Segment Data response is one segment — and since a POST replaces everything, posting TomTom responses one at a time leaves only the last one in force. For more than one TomTom segment, merge them into one edge list yourself:

Python
from oslew import Client

client = Client(base_url="https://api.oslew.com")

def edges_of(segment):
    """One TomTom flowSegmentData as edges: each pair of points, at its current speed."""
    points = segment["coordinates"]["coordinate"]
    return [
        {"at": f"{a['latitude']},{a['longitude']}",
         "to": f"{b['latitude']},{b['longitude']}",
         "speed_kmh": segment["currentSpeed"]}
        for a, b in zip(points, points[1:]) if a != b
    ]

edges = [e for response in tomtom_responses for e in edges_of(response["flowSegmentData"])]
status = client.post_traffic({"edges": edges})
TypeScript
import { Client } from "@oslew/client";

const client = new Client({ baseUrl: "https://api.oslew.com" });

type Coordinate = { latitude: number; longitude: number };

// One TomTom flowSegmentData as edges: each pair of points, at its current speed.
function edgesOf(segment: { currentSpeed: number; coordinates: { coordinate: Coordinate[] } }) {
  const points = segment.coordinates.coordinate;
  return points.slice(1).map((b, i) => ({
    at: `${points[i].latitude},${points[i].longitude}`,
    to: `${b.latitude},${b.longitude}`,
    speed_kmh: segment.currentSpeed,
  }));
}

const edges = tomtomResponses.flatMap((r) => edgesOf(r.flowSegmentData));
const status = await client.post_traffic({ edges });

Any other format is refused: unknown traffic format `x`; tomtom, here or none. A body missing the fields above is a 400 naming the field.

Clearing it

curl
curl -X DELETE "https://api.oslew.com/v1/traffic" \
  -H "Authorization: Bearer $GEO_API_KEY"

The clients leave DELETE out on purpose; send it with curl when you mean it.

Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 17
ratelimit-reset: 1

{
  "applied": false,
  "version": 0,
  "edges_updated": 0,
  "applied_at": null,
  "engine": "none",
  "took_us": 0
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Back to the release's weights on the pod that answered. version reads 0 again, and the next feed on that pod is version 1.

GTFS-Realtime

The body is a GTFS-Realtime FeedMessage in protobuf, as a realtime feed publishes it. TheContent-Type is not checked; send application/x-protobuf for the sake of anything in between. The Python client's post_transit_rt takes the bytes; the TypeScript client's takes aUint8Array.

curl
curl -X POST "https://api.oslew.com/v1/transit_rt" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  -H "Content-Type: application/x-protobuf" \
  --data-binary @tripupdates.pb
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.post_transit_rt(open("tripupdates.pb", "rb").read())
TypeScript
import { readFile } from "node:fs/promises";
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.post_transit_rt(new Uint8Array(await readFile("tripupdates.pb")));
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 16
ratelimit-reset: 1

{
  "applied": true,
  "feed": "bart",
  "feed_time": 1787756100,
  "trip_updates": 1,
  "matched_trips": 1,
  "unknown_trips": 0,
  "stop_updates": 1,
  "unknown_stops": 0,
  "skipped": 0,
  "applied_at": 1790259566,
  "took_us": 123
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

What is read from the message, and what is not:

  • Trip updates, matched to the static timetable by trip_id. For each stop time update, the stop is found by stop_sequence, or by stop_id as the next call at that stop.
  • The delay at a stop is its departure delay, else its arrival delay, else its absolute time minus the scheduled one — using the trip's start_date, or the day of the feed's timestamp, in the timetable's time zone.
  • A delay carries forward to the trip's later stops until the next update changes it, which is how GTFS-Realtime defines propagation. Stops before the first update keep their schedule.
  • A stop time update marked SKIPPED removes that call: the trip does not depart from that stop.
  • Vehicle positions, alerts and trip-level schedule relationships are not applied.

Which feed takes it: of the loaded timetables, the one whose trip ids the message matches most. When it matches no loaded timetable at all the request is refused —none of the N trip updates names a trip in any loaded feed — and with no timetable loaded it isno transit layer loaded. Each POST replaces that timetable's previous delays entirely, so send the full feed each time rather than differences; other timetables' delays are untouched.

FieldIs
appliedWhether live delays are in force for this timetable.
feedThe static timetable that took the message, by its source name.
feed_timeThe realtime message's own timestamp, unix seconds.
trip_updatesTrip updates in the message.
matched_trips, unknown_tripsOf those, trips the timetable knew, and trips it did not.
stop_updates, unknown_stopsStop time updates applied, and those naming no call on their trip.
skippedCalls skipped.
applied_atUnix seconds it was applied.

A large unknown_trips often means the realtime feed and the static timetable come from different releases of the operator's data. The Embarcadero platform with that five-minute delay applied — the first departure's time is scheduled plus delay_s, and live carries the realtime feed's timestamp:

curl
curl -G "https://api.oslew.com/v1/departures" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'stop=M16-1' \
  --data-urlencode 'time=1787756400' \
  --data-urlencode 'limit=3'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.departures(stop="M16-1", time=1787756400, limit=3)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.departures({ stop: "M16-1", time: 1787756400, limit: 3 });
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1

{
  "stop": {
    "id": "M16-1",
    "name": "Embarcadero",
    "lat": 37.792789,
    "lon": -122.39708,
    "parent": 109,
    "platform": "1",
    "boarding": true
  },
  "distance_m": null,
  "time": 1787756400,
  "timezone": "America/Los_Angeles",
  "live": 1787756100,
  "departures": [
    {
      "time": 1787756700,
      "route": 0,
      "route_short_name": "Yellow-S",
      "route_long_name": "Antioch to SF Int'l Airport SFO/Millbrae",
      "headsign": "San Francisco International Airport",
      "trip_id": "1965170",
      "direction": 1,
      "scheduled": 1787756400,
      "delay_s": 300
    },
    {
      "time": 1787756700,
      "route": 4,
      "route_short_name": "Green-S",
      "route_long_name": "Berryessa/North San Jose to Daly City",
      "headsign": "OAK Airport / SF / Daly City",
      "trip_id": "1965492",
      "direction": 1,
      "scheduled": 1787756700,
      "delay_s": 0
    },
    {
      "time": 1787756880,
      "route": 6,
      "route_short_name": "Red-S",
      "route_long_name": "Richmond to SF Int'l Airport SFO/Millbrae",
      "headsign": "SF / SFO Airport / Millbrae",
      "trip_id": "1965631",
      "direction": 1,
      "scheduled": 1787756880,
      "delay_s": 0
    }
  ],
  "provenance": {
    "name": "bart",
    "release": "2026-08-19.0",
    "license": "BART developer terms"
  },
  "took_us": 24
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Status and clearing

The GET answers one entry per loaded timetable. It reports the counts that matter while a feed is in force; trip_updates and applied_at are only in the POST's answer, and read0 and null here:

curl
curl "https://api.oslew.com/v1/transit_rt" \
  -H "Authorization: Bearer $GEO_API_KEY"
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.transit_rt()
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.transit_rt();
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 15
ratelimit-reset: 1

[
  {
    "applied": true,
    "feed": "bart",
    "feed_time": 1787756100,
    "trip_updates": 0,
    "matched_trips": 1,
    "unknown_trips": 0,
    "stop_updates": 1,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Gobierno del estado de México (Government of the State of Mexico)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Ayuntamiento Constitucional de Jilotepec Equipo de Planeación y Movilida (Constitutional Municipality of Jilotepec Planning and Mobility Team)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Secretaría de Transporte del Estado de Jalisco (SETRAN)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  }
]

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

The DELETE drops every timetable's delays on the pod that answered; departures are the schedule again:

curl
curl -X DELETE "https://api.oslew.com/v1/transit_rt" \
  -H "Authorization: Bearer $GEO_API_KEY"

The clients leave DELETE out on purpose; send it with curl when you mean it.

Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 14
ratelimit-reset: 1

[
  {
    "applied": false,
    "feed": "bart",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Gobierno del estado de México (Government of the State of Mexico)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Ayuntamiento Constitucional de Jilotepec Equipo de Planeación y Movilida (Constitutional Municipality of Jilotepec Planning and Mobility Team)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  },
  {
    "applied": false,
    "feed": "Secretaría de Transporte del Estado de Jalisco (SETRAN)",
    "feed_time": null,
    "trip_updates": 0,
    "matched_trips": 0,
    "unknown_trips": 0,
    "stop_updates": 0,
    "unknown_stops": 0,
    "skipped": 0,
    "applied_at": null,
    "took_us": 0
  }
]

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Limits and errors

  • Both routes need a key whose plan includes the operator product; any other key is refused with 403. See products and plans.
  • A body over 2 MB is refused with 413. Because each POST replaces the last, a traffic feed cannot be split across requests: the whole of it has to fit in one body.
  • Refusals are 400 with the service's {"error": "…"}. See errors.
  • The clients have post_traffic, post_transit_rt and the two status methods, and leave both DELETEs out on purpose: send those with curl. See clients.

Endpoints

GET/v1/trafficoperator

Whether live weights are in force, and which engine answers profile=live.

POST/v1/trafficoperator

Apply a traffic feed: roads named by a point (or a stretch between two) with a speed or a factor on the release's time. Live routes answer by Dijkstra at once and by the hierarchy once it is contracted in the background. With ?format=tomtom or ?format=here the body is that vendor's flow JSON as returned by its API.

DELETE/v1/trafficoperator

Discard the live weights.

GET/v1/transit_rtoperator

Whether live transit delays are in force, per loaded feed.

POST/v1/transit_rtoperator

Apply a GTFS-Realtime FeedMessage (protobuf body): trip updates become delays and skipped calls that departures apply on top of the schedule, for the feed whose trips it names.

DELETE/v1/transit_rtoperator

Drop every live transit delay.