Transitland API
transit.land · Location
Open transit data aggregator — 2,000+ transit agencies worldwide, GTFS feeds, stop locations, routes, schedules, and operators. Free, no API key for basic access.
Authentication
API Key
API key from transit.land for higher rate limits. Basic access works without a key.
Sample Requests
GET
Get nearby stops
Find transit stops within 500m of a NYC location.
https://transit.land/api/v2/rest/stops?lat=40.733&lon=-73.989&radius=500
Hover any highlighted part to learn what it does
curl -X GET "https://transit.land/api/v2/rest/stops?lat=40.733&lon=-73.989&radius=500"
import requests
params = {
"lat": "40.733",
"lon": "-73.989",
"radius": "500"
}
response = requests.get(
"https://transit.land/api/v2/rest/stops",
params=params,
)
print(response.json())const url = new URL('https://transit.land/api/v2/rest/stops');
url.searchParams.set('lat', '40.733');
url.searchParams.set('lon', '-73.989');
url.searchParams.set('radius', '500');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://transit.land/api/v2/rest/stops")
q := baseURL.Query()
q.Set("lat", "40.733")
q.Set("lon", "-73.989")
q.Set("radius", "500")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://transit.land/api/v2/rest/stops")
uri.query = URI.encode_www_form({
"lat" => "40.733",
"lon" => "-73.989",
"radius" => "500"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://transit.land/api/v2/rest/stops?" . http_build_query([
"lat" => "40.733",
"lon" => "-73.989",
"radius" => "500"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get operators
Search for transit agencies in New York.
https://transit.land/api/v2/rest/agencies?search=NYC&per_page=3
Hover any highlighted part to learn what it does
curl -X GET "https://transit.land/api/v2/rest/agencies?search=NYC&per_page=3"
import requests
params = {
"search": "NYC",
"per_page": "3"
}
response = requests.get(
"https://transit.land/api/v2/rest/agencies",
params=params,
)
print(response.json())const url = new URL('https://transit.land/api/v2/rest/agencies');
url.searchParams.set('search', 'NYC');
url.searchParams.set('per_page', '3');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://transit.land/api/v2/rest/agencies")
q := baseURL.Query()
q.Set("search", "NYC")
q.Set("per_page", "3")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://transit.land/api/v2/rest/agencies")
uri.query = URI.encode_www_form({
"search" => "NYC",
"per_page" => "3"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://transit.land/api/v2/rest/agencies?" . http_build_query([
"search" => "NYC",
"per_page" => "3"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed for basic use
- Nearby stops: GET /stops?lon=LON&lat=LAT&radius=500
- Routes: GET /routes?agency_key=f-dr5r7-newyorkcitytransit
- Schedules: GET /stop_times?stop_onestop_id=STOP_ID
- Register at transit.land for a free API key for higher limits