SDK Reference
mta.stops.near() — find stops by geolocation
Reference for mta.stops methods in mta-js. Find nearby MTA subway and bus stops sorted by distance from any latitude and longitude.
GET
Find route-aware nearby stops
TheDocumentation Index
Fetch the complete documentation index at: https://mtaapi.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
mta.stops namespace lets you discover MTA stops near any point on the map. Use mta.stops.near to find subway stations, bus stops, or both, sorted by distance from a given latitude and longitude. You can also pass a route to return only stops served by that route — for example, only L train stops or only M23 SBS bus stops within walking distance. This is the recommended starting point when you need stop IDs for use with mta.subway.arrivals or mta.bus.arrivals, or to power a “stops near me” feature in your application.
mta.stops.near(params)
Returns a list of MTA stops within a configurable radius of the provided coordinates, sorted by distance ascending. You can limit results to subway stops, bus stops, or both by passing the modes parameter, and further filter to stops served by a specific route.
Parameters
The latitude of the center point for the search, in decimal degrees (WGS 84). For example,
40.7128 for lower Manhattan.The longitude of the center point for the search, in decimal degrees (WGS 84). For example,
-74.0060 for lower Manhattan.An array of transit modes to include in the results. Accepted values are
'subway' and 'bus'. Pass ['subway'] to return only subway stations, ['bus'] to return only bus stops, or ['subway', 'bus'] to return both. Defaults to both modes if omitted.Optional route filter. When supplied, only stops served by this route are returned. For example,
'L' returns nearby stops served by the L train, and 'M23' returns nearby M23 SBS bus stops. Route IDs are case-sensitive and match MTA’s published identifiers.When
true, each returned stop includes route metadata: a servedRoutes array of ServedRoute objects and a directionHeadsigns map. Defaults to false to keep responses small when you only need stop identity and distance.Search radius in meters. Defaults to
500. Increase this when querying sparse areas or to widen a “stops near me” view.Maximum number of stops to return. Must be between
1 and 100. Results remain sorted by distance ascending.TypeScript signature
Response fields
An array of nearby stops, sorted by
distanceMeters ascending. Returns an empty array if no stops are found within the search radius.Code example
Example response
Route-aware example
Filter to nearby stops served by a specific route. This is useful when you want to find the closest stop on the M23 SBS or the nearest L train station without sorting through every nearby stop yourself.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Required range:
-90 <= x <= 90Required range:
-180 <= x <= 180Comma-separated transit modes to search, such as subway,bus.
Optional route filter. For example, L returns nearby stops served by the L train, and M23 returns nearby M23 SBS bus stops.
Minimum string length:
1Include route metadata for each returned stop.
Search radius in meters. Defaults to 500.
Required range:
x >= 1Required range:
1 <= x <= 100Response
200 - application/json
Response for status 200
Previous
Subway Arrival BoardReference for GET /api/v1/subway/arrival-board. Find nearby subway stations and group their upcoming arrivals by direction in a single request.
Next
Find route-aware nearby stops