TransitLand

TransitLand

Transportation

Transit Aggregation. Transitland brings together many sources of transit data to build a directory of operators and feeds that can be edited by transit enthusiasts and developers. Transitland contains several interlocking parts, including the Feed Registry, the Datastore, and the Playground. Transitland Feed Registry is a directory of transit operators and data feeds. Through the Feed Registry, you can browse operators, feeds, and usage and license information, as well as contribute additional feeds. The directory is a view into Transitland’s Datastore API. Transitland Datastore brings together data from the Feed Registry with contributions, edits, and fixes from transit enthusiasts and developers. The Datastore is a hosted service that provides a web API for querying and editing. Mobility Explorer is an interactive interface for querying the Transitland Datastore API. Transitland Dispatcher is an administrative interface, which also queries the Datastore API. Valhalla is an open-source routing engine that consumes data from the Datastore API and offers journey planning and analysis.

Visit API🔁 Alternatives

📚 Documentation & Examples

Everything you need to integrate with TransitLand

🚀 Quick Start Examples

TransitLand Javascript Examplejavascript
// TransitLand API Example
const response = await fetch('https://transit.land/documentation/datastore/api-endpoints.html', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Exploring Transit Land's Public APIs

Transit Land is a platform that curates and aggregates transit data from transit agencies and other sources. They offer public APIs that provide access to a wealth of transit data that you can use to build apps or improve existing ones.

In this article, we'll explore some of Transit Land's APIs and how to use them in JavaScript.

API Endpoints

Transit Land offers several APIs for accessing transit data. Here are a few of them:

  • https://api.transit.land/api/v2/schedule_stop_pairs - Returns a list of all transit trips that stop at a given stop.
  • https://api.transit.land/api/v1/feed_versions - Returns a list of feed versions available in Transit Land's Datastore.
  • https://api.transit.land/api/v2/router/router - Calculates possible routes between two stops using GTFS transit data.

Let's take a look at how to use these APIs in JavaScript.

Making API Calls in JavaScript

To make API calls from a JavaScript application, we can use the fetch() function, which is native to modern web browsers.

How to Get a Transitland API Key

Transitland's v2 REST API now requires an API key on every request (the older keyless endpoints are retired). A free tier with rate limits is available alongside paid plans.

  1. Sign up and request a key via the Transitland plans page: https://www.transit.land/documentation — follow the "sign up for an API key" link, which routes to app.interline.io.
  2. Choose the free tier to start; upgrade later if you need higher limits.
  3. Pass your key on each request. The recommended method is the apikey query parameter (the apikey: header form also works).
curl "https://transit.land/api/v2/rest/stops?lat=37.77&lon=-122.42&apikey=YOUR_KEY"

The v2 REST base URL is https://transit.land/api/v2/rest, with endpoints such as /stops, /routes, /operators, and /departures. A 401 response means your key is missing or wrong. See the documentation for full endpoint and parameter details.

Example: Schedule Stop Pairs

To retrieve a list of all transit trips that stop at a given stop, we can make a GET request to the schedule_stop_pairs endpoint, passing the stop ID as a parameter.

fetch('https://api.transit.land/api/v2/schedule_stop_pairs?origin_onestop_id=o-9q8y-nfantacitypark&date=2019-05-03')
  .then(response => response.json())
  .then(data => console.log(data));

In this example, we're requesting schedule stop pairs for the stop with the ID o-9q8y-nfantacitypark on May 3, 2019.

Example: Feed Versions

To retrieve a list of feed versions available in Transit Land's Datastore, we can make a GET request to the feed_versions endpoint.

fetch('https://api.transit.land/api/v1/feed_versions')
  .then(response => response.json())
  .then(data => console.log(data));

Example: Router

To calculate possible routes between two stops using GTFS transit data, we can make a POST request to the router endpoint, passing the origin and destination stop IDs in the request body.

const requestBody = JSON.stringify({
  origin_onestop_id: 'o-9q8y-nfantacitypark',
  destination_onestop_id: 'o-9q8y-nfanthewestend'
});

const headers = {
  'Content-Type': 'application/json'
};

fetch('https://api.transit.land/api/v2/router/router', {
  method: 'POST',
  headers,
  body: requestBody
})
  .then(response => response.json())
  .then(data => console.log(data));

In this example, we're calculating possible routes between the stops with the IDs o-9q8y-nfantacitypark and o-9q8y-nfanthewestend.

Conclusion

In this article, we've explored a few of Transit Land's public APIs and how to use them in JavaScript. With these APIs, you can access a variety of transit data that you can use to build powerful transit-related apps and solutions.

Explore More

Best TransitLand alternatives (2026)Best Transportation APIs

Related APIs in Transportation