Barrelman Docs

Transit

Trip planning via MOTIS plus live GTFS-RT data — vehicle positions, departures, stops, route detail, and station geometry.

Get transit route between two points

Queries the MOTIS transit router for itineraries between two coordinates. Returns transit legs with boarding/alighting stops, route info, and geometry. Walking legs are straight-line estimates — the Parchment server replaces them with actual GraphHopper walking routes.

POST
/transit/route

Request Body

application/jsonRequired
fromRequiredobject
toRequiredobject
timestring
arriveByboolean
numItinerariesnumber
Minimum: 1Maximum: 10
searchWindownumber
Minimum: 1
transitModesarray<string>
maxWalkDistancenumber
Minimum: 0
maxTransfersnumber
Minimum: 0
wheelchairboolean

Response Body

curl -X POST "https://example.com/transit/route" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "lat": -90,
      "lng": -180
    },
    "to": {
      "lat": -90,
      "lng": -180
    },
    "time": "string",
    "arriveBy": true,
    "numItineraries": 1,
    "searchWindow": 1,
    "transitModes": [
      "string"
    ],
    "maxWalkDistance": 0,
    "maxTransfers": 0,
    "wheelchair": true
  }'
const body = JSON.stringify({
  "from": {
    "lat": -90,
    "lng": -180
  },
  "to": {
    "lat": -90,
    "lng": -180
  },
  "time": "string",
  "arriveBy": true,
  "numItineraries": 1,
  "searchWindow": 1,
  "transitModes": [
    "string"
  ],
  "maxWalkDistance": 0,
  "maxTransfers": 0,
  "wheelchair": true
})

fetch("https://example.com/transit/route", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/transit/route"
  body := strings.NewReader(`{
    "from": {
      "lat": -90,
      "lng": -180
    },
    "to": {
      "lat": -90,
      "lng": -180
    },
    "time": "string",
    "arriveBy": true,
    "numItineraries": 1,
    "searchWindow": 1,
    "transitModes": [
      "string"
    ],
    "maxWalkDistance": 0,
    "maxTransfers": 0,
    "wheelchair": true
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/route"
body = {
  "from": {
    "lat": -90,
    "lng": -180
  },
  "to": {
    "lat": -90,
    "lng": -180
  },
  "time": "string",
  "arriveBy": true,
  "numItineraries": 1,
  "searchWindow": 1,
  "transitModes": [
    "string"
  ],
  "maxWalkDistance": 0,
  "maxTransfers": 0,
  "wheelchair": true
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Intermodal routing with mode selection

Coordinate-based intermodal routing via MOTIS. Supports pre/post-transit mode selection (WALK, BIKE, CAR_PARKING, RENTAL) and direct non-transit modes. Requires MOTIS to have OSM street data loaded. Returns legs with real OSM geometry for walk/bike/car segments.

POST
/transit/intermodal-route

Request Body

application/jsonRequired
fromRequiredobject
toRequiredobject
timestring
arriveByboolean
numItinerariesnumber
Minimum: 1Maximum: 10
searchWindownumber
Minimum: 1
transitModesarray<string>
maxWalkDistancenumber
Minimum: 0
maxTransfersnumber
Minimum: 0
wheelchairboolean
preTransitModesarray<string>
postTransitModesarray<string>
directModesarray<string>
maxDirectTimenumber
Minimum: 0
maxPreTransitTimenumber
Minimum: 0
maxPostTransitTimenumber
Minimum: 0
preTransitRentalFormFactorsarray<string>
postTransitRentalFormFactorsarray<string>

Response Body

curl -X POST "https://example.com/transit/intermodal-route" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "lat": -90,
      "lng": -180
    },
    "to": {
      "lat": -90,
      "lng": -180
    },
    "time": "string",
    "arriveBy": true,
    "numItineraries": 1,
    "searchWindow": 1,
    "transitModes": [
      "string"
    ],
    "maxWalkDistance": 0,
    "maxTransfers": 0,
    "wheelchair": true,
    "preTransitModes": [
      "string"
    ],
    "postTransitModes": [
      "string"
    ],
    "directModes": [
      "string"
    ],
    "maxDirectTime": 0,
    "maxPreTransitTime": 0,
    "maxPostTransitTime": 0,
    "preTransitRentalFormFactors": [
      "string"
    ],
    "postTransitRentalFormFactors": [
      "string"
    ]
  }'
const body = JSON.stringify({
  "from": {
    "lat": -90,
    "lng": -180
  },
  "to": {
    "lat": -90,
    "lng": -180
  },
  "time": "string",
  "arriveBy": true,
  "numItineraries": 1,
  "searchWindow": 1,
  "transitModes": [
    "string"
  ],
  "maxWalkDistance": 0,
  "maxTransfers": 0,
  "wheelchair": true,
  "preTransitModes": [
    "string"
  ],
  "postTransitModes": [
    "string"
  ],
  "directModes": [
    "string"
  ],
  "maxDirectTime": 0,
  "maxPreTransitTime": 0,
  "maxPostTransitTime": 0,
  "preTransitRentalFormFactors": [
    "string"
  ],
  "postTransitRentalFormFactors": [
    "string"
  ]
})

fetch("https://example.com/transit/intermodal-route", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/transit/intermodal-route"
  body := strings.NewReader(`{
    "from": {
      "lat": -90,
      "lng": -180
    },
    "to": {
      "lat": -90,
      "lng": -180
    },
    "time": "string",
    "arriveBy": true,
    "numItineraries": 1,
    "searchWindow": 1,
    "transitModes": [
      "string"
    ],
    "maxWalkDistance": 0,
    "maxTransfers": 0,
    "wheelchair": true,
    "preTransitModes": [
      "string"
    ],
    "postTransitModes": [
      "string"
    ],
    "directModes": [
      "string"
    ],
    "maxDirectTime": 0,
    "maxPreTransitTime": 0,
    "maxPostTransitTime": 0,
    "preTransitRentalFormFactors": [
      "string"
    ],
    "postTransitRentalFormFactors": [
      "string"
    ]
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/intermodal-route"
body = {
  "from": {
    "lat": -90,
    "lng": -180
  },
  "to": {
    "lat": -90,
    "lng": -180
  },
  "time": "string",
  "arriveBy": true,
  "numItineraries": 1,
  "searchWindow": 1,
  "transitModes": [
    "string"
  ],
  "maxWalkDistance": 0,
  "maxTransfers": 0,
  "wheelchair": true,
  "preTransitModes": [
    "string"
  ],
  "postTransitModes": [
    "string"
  ],
  "directModes": [
    "string"
  ],
  "maxDirectTime": 0,
  "maxPreTransitTime": 0,
  "maxPostTransitTime": 0,
  "preTransitRentalFormFactors": [
    "string"
  ],
  "postTransitRentalFormFactors": [
    "string"
  ]
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Find nearby transit stops

Returns transit stops within a radius of the given coordinates, ordered by distance. Uses PostGIS spatial index for efficient radius queries. Only returns stops (location_type=0), not stations or entrances.

GET
/transit/stops

Query Parameters

latRequiredstring
lngRequiredstring
radiusstring
limitstring

Response Body

curl -X GET "https://example.com/transit/stops?lat=string&lng=string&radius=string&limit=string"
fetch("https://example.com/transit/stops?lat=string&lng=string&radius=string&limit=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/stops?lat=string&lng=string&radius=string&limit=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/stops?lat=string&lng=string&radius=string&limit=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get routes serving a stop

Returns all transit routes that pass through the specified stop, including route name, color, type, and agency information.

GET
/transit/routes

Query Parameters

feedIdRequiredstring
stopIdRequiredstring

Response Body

curl -X GET "https://example.com/transit/routes?feedId=string&stopId=string"
fetch("https://example.com/transit/routes?feedId=string&stopId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/routes?feedId=string&stopId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/routes?feedId=string&stopId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get upcoming departures at nearby stops

Returns upcoming departures from transit stops near the given coordinates. Queries the MOTIS timetable and enriches results with route colors from the GTFS database. Supports direct stop queries via feedId/stopId, or spatial search via lat/lng/radius.

GET
/transit/departures

Query Parameters

latstring
lngstring
radiusstring
timestring
nstring
feedIdstring
stopIdstring
routeShortNamesstring
directionIdstring

Response Body

curl -X GET "https://example.com/transit/departures?lat=string&lng=string&radius=string&time=string&n=string&feedId=string&stopId=string&routeShortNames=string&directionId=string"
fetch("https://example.com/transit/departures?lat=string&lng=string&radius=string&time=string&n=string&feedId=string&stopId=string&routeShortNames=string&directionId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/departures?lat=string&lng=string&radius=string&time=string&n=string&feedId=string&stopId=string&routeShortNames=string&directionId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/departures?lat=string&lng=string&radius=string&time=string&n=string&feedId=string&stopId=string&routeShortNames=string&directionId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get live vehicle positions within a bounding box

Fetches GTFS-RT VehiclePosition data from all configured feeds and returns vehicles within the specified bounding box. Results are enriched with route colors and short names. Responses are cached for 10 seconds per feed.

GET
/transit/vehicles

Query Parameters

northRequiredstring
southRequiredstring
eastRequiredstring
westRequiredstring
feedIdstring
routeIdstring

Response Body

curl -X GET "https://example.com/transit/vehicles?north=string&south=string&east=string&west=string&feedId=string&routeId=string"
fetch("https://example.com/transit/vehicles?north=string&south=string&east=string&west=string&feedId=string&routeId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/vehicles?north=string&south=string&east=string&west=string&feedId=string&routeId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/vehicles?north=string&south=string&east=string&west=string&feedId=string&routeId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get route shape geometry

Returns the GTFS shape coordinates for a specific route, used for snapping live vehicle positions to the actual route geometry on the map. Coordinates are in [lng, lat] order. Responses are cached for 24 hours (shapes are static GTFS data).

GET
/transit/shapes

Query Parameters

feedIdRequiredstring
routeIdRequiredstring

Response Body

curl -X GET "https://example.com/transit/shapes?feedId=string&routeId=string"
fetch("https://example.com/transit/shapes?feedId=string&routeId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/shapes?feedId=string&routeId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/shapes?feedId=string&routeId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get route detail with ordered stops and shape

Returns route metadata, geographically ordered stops, shape geometry, and related route IDs (same trunk line) for rendering an isolated route detail view.

GET
/transit/route-detail

Query Parameters

feedIdRequiredstring
routeIdRequiredstring

Response Body

curl -X GET "https://example.com/transit/route-detail?feedId=string&routeId=string"
fetch("https://example.com/transit/route-detail?feedId=string&routeId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/route-detail?feedId=string&routeId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/route-detail?feedId=string&routeId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get all vehicles on specific routes (no bounding box)

GET
/transit/route-vehicles

Query Parameters

routeIdsRequiredstring
feedIdstring

Response Body

curl -X GET "https://example.com/transit/route-vehicles?routeIds=string&feedId=string"
fetch("https://example.com/transit/route-vehicles?routeIds=string&feedId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/route-vehicles?routeIds=string&feedId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/route-vehicles?routeIds=string&feedId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Get real-time stop times for a specific trip

GET
/transit/trip-stops

Query Parameters

feedIdRequiredstring
tripIdRequiredstring

Response Body

curl -X GET "https://example.com/transit/trip-stops?feedId=string&tripId=string"
fetch("https://example.com/transit/trip-stops?feedId=string&tripId=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/trip-stops?feedId=string&tripId=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/trip-stops?feedId=string&tripId=string"

response = requests.request("GET", url)

print(response.text)
Empty

Batch check bikes_allowed for routes

GET
/transit/bikes-allowed

Query Parameters

routesRequiredstring

Response Body

curl -X GET "https://example.com/transit/bikes-allowed?routes=string"
fetch("https://example.com/transit/bikes-allowed?routes=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/bikes-allowed?routes=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/bikes-allowed?routes=string"

response = requests.request("GET", url)

print(response.text)
Empty

Discover GTFS-RT feed URLs

Queries Transitland to discover GTFS-RT feed URLs (vehicle positions, trip updates, alerts) for existing feeds. If feedId is provided, only discovers for that feed; otherwise discovers for all feeds missing RT URLs.

POST
/transit/discover-rt-urls

Request Body

application/jsonRequired
feedIdstring

Response Body

curl -X POST "https://example.com/transit/discover-rt-urls" \
  -H "Content-Type: application/json" \
  -d '{
    "feedId": "string"
  }'
const body = JSON.stringify({
  "feedId": "string"
})

fetch("https://example.com/transit/discover-rt-urls", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/transit/discover-rt-urls"
  body := strings.NewReader(`{
    "feedId": "string"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/discover-rt-urls"
body = {
  "feedId": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Get station detail with entrances and building geometry

Returns a GTFS station with its OSM-linked entrances (subway/train station entrances within 200m) and building polygon geometry. Entrances include descriptions, wheelchair accessibility, and level information.

GET
/transit/station/{feedId}/{stopId}

Path Parameters

feedIdRequiredstring
stopIdRequiredstring

Response Body

curl -X GET "https://example.com/transit/station/string/string"
fetch("https://example.com/transit/station/string/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/station/string/string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/station/string/string"

response = requests.request("GET", url)

print(response.text)
Empty

Find nearest station entrance to a coordinate

Returns the closest subway or train station entrance to the given coordinate, within maxDistance meters (default 500m). Pass wheelchair=true for accessible access points only: entrances tagged wheelchair=no are excluded, vertical access requires elevators instead of stairs, and confirmed-accessible entrances are preferred.

GET
/transit/nearest-entrance

Query Parameters

latRequiredstring
lonRequiredstring
maxDistancestring
wheelchairstring

Response Body

curl -X GET "https://example.com/transit/nearest-entrance?lat=string&lon=string&maxDistance=string&wheelchair=string"
fetch("https://example.com/transit/nearest-entrance?lat=string&lon=string&maxDistance=string&wheelchair=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/transit/nearest-entrance?lat=string&lon=string&maxDistance=string&wheelchair=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/transit/nearest-entrance?lat=string&lon=string&maxDistance=string&wheelchair=string"

response = requests.request("GET", url)

print(response.text)
Empty