{"components":{"securitySchemes":{"ApiKeyHeader":{"in":"header","name":"X-Api-Key","type":"apiKey"},"ApiKeyQuery":{"in":"query","name":"api_key","type":"apiKey"}}},"info":{"description":"National UK transit data REST API - stops, places, live bus departures and journey planning.","title":"TransCAPI","version":"0.1.0"},"openapi":"3.0.3","paths":{"/v1/bus/routes.json":{"get":{"parameters":[{"description":"Line number or name, e.g. \"36\" or \"X1\"","in":"query","name":"q","schema":{"type":"string"}},{"description":"Operator name or agency id","in":"query","name":"operator","schema":{"type":"string"}},{"description":"Only routes calling at this stop","in":"query","name":"atcocode","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"List of routes"},"400":{"description":"No search criterion given"}},"summary":"Find bus routes by line number, operator, or a stop they serve","tags":["Bus"]}},"/v1/bus/routes/{route_id}.json":{"get":{"description":"A route id covers every journey run under one line number by one operator, including short workings and school journeys, so `representative_stops` is the longest single journey found rather than a union of them. `timetable` lists that day's journeys in departure order; each carries a `trip_id` to look up with /v1/bus/services/{trip_id}.json.\n\nEach entry in `directions` carries a `shape`: the path those journeys actually take, as an encoded polyline (Google algorithm, precision 5) with its point count and length in metres. It is null where the operator publishes no geometry. Do not substitute a line drawn through `representative_stops` for it -- that cuts through buildings and down roads no bus can use.\n","parameters":[{"in":"path","name":"route_id","required":true,"schema":{"type":"string"}},{"description":"Service date (default today, UK local)","in":"query","name":"date","schema":{"format":"date","type":"string"}},{"in":"query","name":"direction","schema":{"enum":[0,1],"type":"integer"}},{"description":"Journeys per page of the timetable","in":"query","name":"limit","schema":{"default":50,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"Route detail"},"404":{"description":"Route not found"}},"summary":"A bus route's directions, stops and timetable for a day","tags":["Bus"]}},"/v1/bus/services/{trip_id}.json":{"get":{"description":"Answers \"where does the 09:42 stop, and where has it got to?\" for a single journey. `trip_id` is the value returned as `trip_id` (or `dated_vehicle_journey_ref`) on a stop timetable, or in a route's timetable. `live_vehicle` carries the tracked position and `current_stop_sequence` when a vehicle is working the journey right now, and is null otherwise - including for a journey later today, which has not set off and so has nothing to report.\n","parameters":[{"in":"path","name":"trip_id","required":true,"schema":{"type":"string"}},{"description":"Service date the times are for (default today, UK local)","in":"query","name":"date","schema":{"format":"date","type":"string"}},{"description":"Look up the live vehicle position for this journey","in":"query","name":"live","schema":{"default":true,"type":"boolean"}}],"responses":{"200":{"description":"Service detail"},"404":{"description":"Service not found"}},"summary":"One scheduled journey - every stop it calls at, and where it is now","tags":["Bus"]}},"/v1/bus/stop_timetables/{atcocode}.json":{"get":{"parameters":[{"in":"path","name":"atcocode","required":true,"schema":{"type":"string"}},{"description":"ISO 8601 datetime to plan around (default now)","in":"query","name":"datetime","schema":{"format":"date-time","type":"string"}},{"description":"Minutes from `datetime` to start the departure window","in":"query","name":"from_offset","schema":{"default":0,"type":"integer"}},{"description":"Minutes from `datetime` to end the departure window","in":"query","name":"to_offset","schema":{"default":60,"type":"integer"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"description":"Also fetch live BODS SIRI-VM vehicle positions and match them to departures. Applies to departures only - the feed carries an origin departure time to match on, not an arrival time at this stop.\n","in":"query","name":"live","schema":{"default":false,"type":"boolean"}},{"description":"Which board to return. `arrivals` lists services terminating or calling here by the time they arrive, including those that terminate at this stop and so never appear as a departure.\n","in":"query","name":"type","schema":{"default":"departures","enum":["departures","arrivals","both"],"type":"string"}}],"responses":{"200":{"description":"Stop timetable"},"404":{"description":"Stop not found"}},"summary":"Departures and arrivals for a stop, combining scheduled GTFS data with live BODS SIRI-VM positions","tags":["Bus"]}},"/v1/bus/stops.json":{"get":{"description":"Roughly a third of stop names are shared by more than one stop, because a name describes a place and the two poles either side of a road are both at it. Three fields tell them apart. `towards` is the commonest destination of journeys calling there, derived from the timetable, and is the one a passenger can act on. `towards_next` is the first differently-named stop the bus calls at next, which separates the pairs that share a destination -- any circular route does. `bearing` is NaPTAN's own compass direction and is the weakest of the three: opposite poles on one road are frequently given the same one.\n","parameters":[{"in":"query","name":"lat","schema":{"type":"number"}},{"in":"query","name":"lon","schema":{"type":"number"}},{"description":"Search radius in metres (used with lat/lon)","in":"query","name":"radius","schema":{"default":400,"type":"integer"}},{"in":"query","name":"min_lat","schema":{"type":"number"}},{"in":"query","name":"min_lon","schema":{"type":"number"}},{"in":"query","name":"max_lat","schema":{"type":"number"}},{"in":"query","name":"max_lon","schema":{"type":"number"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}},{"in":"query","name":"type","schema":{"items":{"enum":["bus_stop","train_station","tram_stop"],"type":"string"},"type":"array"}}],"responses":{"200":{"description":"List of stops"}},"summary":"Find bus/tram/rail stops near a location or within a bounding box","tags":["Bus"]}},"/v1/disruptions.json":{"get":{"description":"Combines the DfT's national BODS SIRI-SX bus situation feed with TfL's line status for the Tube, DLR, Overground, Elizabeth line and trams, normalised into one shape. Each result carries the `source` it came from. National Rail engineering works are not covered - they come from the Network Rail Knowledgebase, which this deployment has no credentials for.\n\nBy default only disruptions currently in force are returned, and lines running a good service are omitted; pass `include_good_service=true` to see every TfL line's status including the healthy ones. The `sources` object reports when each feed was last retrieved and whether it last failed, so an empty list is distinguishable from an outage.\n","parameters":[{"description":"Comma-separated modes to include - any of `bus`, `tram`, `rail`, `tube`, `dlr`, `overground`, `elizabeth-line`. Default is all of them. `tram` draws on both feeds. `rail` covers only the few rail situations bus operators publish through SIRI-SX, not National Rail engineering works.\n","in":"query","name":"mode","schema":{"type":"string"}},{"description":"Comma-separated severities - any of `severe`, `minor`, `information`, `good`, `unknown`.\n","in":"query","name":"severity","schema":{"type":"string"}},{"description":"Only disruptions naming this stop as affected","in":"query","name":"atcocode","schema":{"type":"string"}},{"description":"Operator name or code, matched as a substring","in":"query","name":"operator","schema":{"type":"string"}},{"description":"Line or route name, matched as a substring","in":"query","name":"line","schema":{"type":"string"}},{"in":"query","name":"lat","schema":{"type":"number"}},{"in":"query","name":"lon","schema":{"type":"number"}},{"description":"Search radius in metres around lat/lon. Only disruptions naming at least one stop with coordinates can match a geographic query.\n","in":"query","name":"radius","schema":{"default":2000,"type":"integer"}},{"in":"query","name":"min_lat","schema":{"type":"number"}},{"in":"query","name":"min_lon","schema":{"type":"number"}},{"in":"query","name":"max_lat","schema":{"type":"number"}},{"in":"query","name":"max_lon","schema":{"type":"number"}},{"description":"An encoded polyline (precision 5, as OpenTripPlanner and Google Maps emit) describing a route. Only disruptions naming a stop within `path_radius` metres of it are returned. Use this rather than a bounding box to ask \"what is disrupting this journey\": a service number identifies a route only within one operator's area, so filtering by `line` alone will match the same number in other towns. Matching uses each situation's complete stop list, not the capped one in the response.\n","in":"query","name":"path","schema":{"type":"string"}},{"description":"How far from the path a stop may be, in metres. Maximum 5000. Only meaningful alongside `path`.\n","in":"query","name":"path_radius","schema":{"default":300,"type":"integer"}},{"description":"True for planned works only, false for unplanned incidents only. Omit to include both.\n","in":"query","name":"planned","schema":{"type":"boolean"}},{"description":"Exclude disruptions whose validity period has not started or has ended","in":"query","name":"active_only","schema":{"default":true,"type":"boolean"}},{"in":"query","name":"include_good_service","schema":{"default":false,"type":"boolean"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"List of disruptions"}},"summary":"Planned works, incidents and line status across bus and TfL rail modes","tags":["Disruptions"]}},"/v1/journey.json":{"get":{"description":"Returns transit itineraries between two coordinates, with per-leg fare estimates and live vehicle positions where available, plus optional walking and cycling alternatives. Journey planning is limited to the area covered by the routing graph; see the `coverage` object in the response and the Journey docs for the current extent.\n","parameters":[{"in":"query","name":"from_lat","required":true,"schema":{"type":"number"}},{"in":"query","name":"from_lon","required":true,"schema":{"type":"number"}},{"in":"query","name":"to_lat","required":true,"schema":{"type":"number"}},{"in":"query","name":"to_lon","required":true,"schema":{"type":"number"}},{"description":"ISO8601 datetime for departure (or arrival if arrive_by=true). Defaults to now.","in":"query","name":"datetime","schema":{"type":"string"}},{"in":"query","name":"arrive_by","schema":{"default":false,"type":"boolean"}},{"description":"Comma-separated non-transit alternatives to compute alongside the transit result - any of `walk`, `bicycle`, `car`. Pass an empty value to skip them. Transit is always returned. `car` is off by default and returns a single driving itinerary for comparison against transit; like the other alternatives it is subject to the same coverage area, since driving needs the same street network.\n","in":"query","name":"modes","schema":{"default":"walk,bicycle","type":"string"}},{"description":"Comma-separated optional transit sub-modes - any of `tram`, `rail`. Bus and coach are always included. Pass an empty value to search bus and coach only.\n","in":"query","name":"transit_modes","schema":{"default":"tram,rail","type":"string"}},{"in":"query","name":"include_fares","schema":{"default":true,"type":"boolean"}},{"in":"query","name":"include_live","schema":{"default":true,"type":"boolean"}},{"description":"Include every stop called at on each transit leg.","in":"query","name":"include_intermediate_stops","schema":{"default":false,"type":"boolean"}},{"description":"Maximum length in metres of any single walking leg. Itineraries with a longer walk are excluded. Does not apply to the direct walking alternative.\n","in":"query","name":"max_walk_distance","schema":{"type":"integer"}},{"description":"Maximum total metres walked across the whole journey, summed over every walking leg. Does not apply to the direct walking alternative.\n","in":"query","name":"max_total_walk_distance","schema":{"type":"integer"}},{"description":"Include turn-by-turn directions on each walking leg - direction, street name, distance and coordinate per step.\n","in":"query","name":"include_steps","schema":{"default":false,"type":"boolean"}},{"in":"query","name":"limit","schema":{"default":5,"type":"integer"}}],"responses":{"200":{"description":"Journey itineraries"},"422":{"description":"Origin or destination lies outside the routing coverage area"}},"summary":"Plan a journey between two points","tags":["Journey"]}},"/v1/places.json":{"get":{"parameters":[{"description":"Free text search term","in":"query","name":"query","schema":{"type":"string"}},{"explode":true,"in":"query","name":"type","schema":{"items":{"enum":["bus_stop","train_station","tram_stop","settlement","postcode"],"type":"string"},"type":"array"},"style":"form"},{"in":"query","name":"lat","schema":{"type":"number"}},{"in":"query","name":"lon","schema":{"type":"number"}},{"in":"query","name":"min_lat","schema":{"type":"number"}},{"in":"query","name":"min_lon","schema":{"type":"number"}},{"in":"query","name":"max_lat","schema":{"type":"number"}},{"in":"query","name":"max_lon","schema":{"type":"number"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"List of matching places"}},"summary":"Search for places (stops, settlements, postcodes, addresses)","tags":["Places"]}},"/v1/rail/routes.json":{"get":{"description":"The rail schedule is built from the Network Rail CIF feed, which groups services by operator rather than by named line - so a rail route is one train operating company, and its `operator` field names it. Use /v1/rail/services/{trip_id}.json for an individual train.\n","parameters":[{"description":"Operator name or 2-letter ATOC code, e.g. \"Northern\" or \"NT\"","in":"query","name":"q","schema":{"type":"string"}},{"in":"query","name":"operator","schema":{"type":"string"}},{"description":"Only operators calling at this station","in":"query","name":"crs_code","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"List of routes"},"400":{"description":"No search criterion given"}},"summary":"Find rail routes by operator","tags":["Rail"]}},"/v1/rail/routes/{route_id}.json":{"get":{"description":"Because a rail route is a whole operator, `timetable` here is every train that operator runs on the date - thousands for the largest ones - so it is paged, and `representative_stops` is one journey's calling points rather than anything resembling a line.\n","parameters":[{"description":"2-letter ATOC code, e.g. NT for Northern","in":"path","name":"route_id","required":true,"schema":{"type":"string"}},{"description":"Service date (default today, UK local)","in":"query","name":"date","schema":{"format":"date","type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"Route detail"},"404":{"description":"Route not found"}},"summary":"A rail operator's services for a day","tags":["Rail"]}},"/v1/rail/services/{trip_id}.json":{"get":{"description":"Answers \"where does the 09:42 to Leeds stop?\" for a single train. `trip_id` comes from the `trip_id` field of a station timetable or a route's timetable. There is no live position: the rail schedule here is the timetabled CIF feed, with no real-time movement feed behind it.\n","parameters":[{"in":"path","name":"trip_id","required":true,"schema":{"type":"string"}},{"description":"Service date the times are for (default today, UK local)","in":"query","name":"date","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"Service detail"},"404":{"description":"Service not found"}},"summary":"One train - every station it calls at, and when","tags":["Rail"]}},"/v1/rail/station_timetables/{crs_code}.json":{"get":{"parameters":[{"description":"3-letter station CRS code, e.g. LDS for Leeds","in":"path","name":"crs_code","required":true,"schema":{"type":"string"}},{"description":"ISO 8601 datetime to plan around (default now)","in":"query","name":"datetime","schema":{"format":"date-time","type":"string"}},{"description":"Minutes from `datetime` to start the departure window","in":"query","name":"from_offset","schema":{"default":0,"type":"integer"}},{"description":"Minutes from `datetime` to end the departure window","in":"query","name":"to_offset","schema":{"default":60,"type":"integer"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"description":"Which board to return. `arrivals` lists services by the time they reach this station, including those terminating here, which a departure board can never show.\n","in":"query","name":"type","schema":{"default":"departures","enum":["departures","arrivals","both"],"type":"string"}}],"responses":{"200":{"description":"Station timetable"},"404":{"description":"Station not found"}},"summary":"Scheduled departures and arrivals for a rail station","tags":["Rail"]}},"/v1/rail/stations.json":{"get":{"parameters":[{"in":"query","name":"lat","schema":{"type":"number"}},{"in":"query","name":"lon","schema":{"type":"number"}},{"description":"Search radius in metres (used with lat/lon)","in":"query","name":"radius","schema":{"default":5000,"type":"integer"}},{"in":"query","name":"min_lat","schema":{"type":"number"}},{"in":"query","name":"min_lon","schema":{"type":"number"}},{"in":"query","name":"max_lat","schema":{"type":"number"}},{"in":"query","name":"max_lon","schema":{"type":"number"}},{"in":"query","name":"limit","schema":{"default":20,"type":"integer"}},{"in":"query","name":"page","schema":{"default":1,"type":"integer"}}],"responses":{"200":{"description":"List of rail stations"}},"summary":"Find rail stations near a location or within a bounding box","tags":["Rail"]}}},"servers":[{"description":"Production","url":"https://api.transcapi.com"}]}
