Transiter API
This is the API for the Transiter app.
Resource Group ¶
Stops ¶
GET/api/stops/{geohash}
Get stops within a geohash region.
Returns a GeoJSON FeatureCollection containing stops within a geohash region.
The geohash must be at least 5 characters long and start with dr4, dr5, dr6, dr7, dqg.
The response is encoded in JSON or Protobuf, depending on the Accept header.
Example URI
GET https://transiter.app/api/stops/dr5rud
URI Parameters
- geohash
string(required) Example: dr5rudGeohash of the area to search for stops in.
Request
JSONHeaders
Accept: application/jsonResponse
200Headers
Content-Type: application/jsonBody
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-73.976848,
40.751776
]
},
"properties": {
"ada": true,
"airport": true,
"provider": "mta_subway",
"routes": "4,5,6,7",
"stopID": "631",
"stopName": "Grand Central-42 St"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-73.978759,
40.753337
]
},
"properties": {
"provider": "mta_bus",
"stopID": "400561",
"stopName": "Madison Ave \u0026 E 42st"
}
]
}
Schema
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["FeatureCollection"]
},
"features": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["Feature"]
},
"geometry": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["Point"]
},
"coordinates": {
"type": "array",
"items": {
"type": "number"
}
}
},
},
"properties": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"provider": {
"type": "string"
}
}
}
}
}
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "Invalid geohash"
}Schema
{
"type": "object",
"properties": {
"error": {
"type": "string"
}
},
"required": [
"error"
]
}Predictions ¶
GET/api/predictions/{provider}/{stop_id}
Returns a list of ETA predictions for a stop. The response is encoded in JSON or Protobuf, depending on the Accept header.
Example URI
GET https://transiter.app/api/predictions/mta_subway/631
URI Parameters
- provider
string(required) Example: mta_subwayThe provider of the stop
- stop_id
string(required) Example: 631The ID of the stop
Response
200Headers
Content-Type: application/jsonBody
{
"predictions": [
{
"time": 3,
"units": " min.",
"direction": "Pelham Bay Park",
"routeNumber": "6",
"gate": "↑",
"color": "green"
},
{
"time": 4,
"units": " min.",
"direction": "Crown Hts-Utica Av",
"routeNumber": "4",
"gate": "↓",
"color": "green"
}
]
}Schema
{
"type": "object",
"properties": {
"predictions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"time": {
"type": "number"
},
"units": {
"type": "string"
},
"direction": {
"type": "string"
},
"routeNumber": {
"type": "string"
},
"gate": {
"type": "string"
},
"color": {
"type": "string"
}
}
}
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "Invalid provider"
}Schema
{
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}