oslew docs
Console
Menu

TransitroutingoperationId departures

GET/v1/departures

The next scheduled departures from a stop, or from the nearest stop to a point, on the feed's calendar in its own time zone.

Send Authorization: Bearer sk_live_…. The key's plan must include therouting product; which plans do.

Explained in Stops and departures and Operator feeds.

Example

The next trains from one platform.

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: 292
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": null,
  "departures": [
    {
      "time": 1787756400,
      "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": 0
    },
    {
      "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": 9
}

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

Query

NameTypeDescription
stop
query
string
A stop id as the feed names it; one of stop or at.
at
query
string
lat,lon: the nearest stop within 1 km.
time
query
integer
Unix seconds; now when absent.
limit
query
integer
≥ 1, ≤ 50
default 5

Responses

200 — Departures at or after the instant, in order; trips past midnight belong to the previous service day.

  • departuresobject[]required
    • delay_sintegerrequired
      Live minus scheduled; 0 without a feed.
    • directionintegerrequired
    • headsignstringrequired
    • routeintegerrequired
      Index into the feed's routes.
    • route_long_namestringrequired
    • route_short_namestringrequired
    • scheduledintegerrequired
      The timetable's time, unix seconds.
    • timeintegerrequired
      Unix seconds, live when a realtime feed is applied.
    • trip_idstringrequired
  • distance_mnumber | nullrequired
  • liveinteger | nullrequired
    The realtime feed's timestamp when live delays are applied.
  • provenanceSourcerequired
    • licensestringrequired
    • namestringrequired
    • releasestringrequired
  • stopStoprequired
    • boardingbooleanrequired
      A platform or stop rather than a station.
    • idstringrequired
    • latnumberrequired
    • lonnumberrequired
    • namestringrequired
    • parentinteger | nullrequired
      Index of the parent station in the feed's stops.
    • platformstring | nullrequired
  • timeintegerrequired
  • timezonestringrequired
  • took_usintegerrequired

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400Bad request, unknown stop, or no stop near the point.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

More examples

The same platform with the delay applied
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.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.