# Mbta — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Track real-time subway, bus, and commuter rail departures across Greater Boston, check schedules and service alerts, and find detailed information about routes and stops. Plan your commute with up-to-the-minute MBTA transit data and never miss your connection.

**Category:** Maps & Geospatial | **Website:** [mbta.com/](https://mbta.com/) | **Docs:** [parse.bot/marketplace/9ff80d68-4d01-4734-a67b-5d8aff049ca5/mbta-com-api](https://parse.bot/marketplace/9ff80d68-4d01-4734-a67b-5d8aff049ca5/mbta-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_bus_routes

Retrieve all MBTA bus routes including Silver Line, crosstown, and local routes. Returns each route's ID, display name, and schedule URL. Over 150 routes are typically returned.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_bus_routes \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_commuter_rail_lines

Retrieve all MBTA Commuter Rail lines. Returns each line's ID, display name, and schedule URL. Covers the regional rail network radiating from Boston.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_commuter_rail_lines \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_route_alerts

Retrieve current service alerts for one or more routes. Returns alerts with header, description, effect (delay, elevator_closure, etc.), cause, severity, priority, active periods, and affected entities (stops, routes, facilities). An empty array is returned when no alerts are active.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `route_ids` | string | Yes | Comma-separated route IDs (e.g. 'Red', 'Red,Orange', 'CR-Fitchburg'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_route_alerts \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"route_ids":"<string>"}'
```

### get_route_details

Retrieve detailed stop and station information for a specific route in a given direction. Returns a stop tree with station features (accessibility, parking, bike storage, connections to other lines), route metadata, and branch information. The stop tree includes edges for ordered traversal.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `direction_id` | integer | No | Direction of travel: 0 for southbound/outbound, 1 for northbound/inbound. |
| `route_id` | string | Yes | Route ID as returned by get_subway_lines, get_bus_routes, or get_commuter_rail_lines (e.g. 'Red', '1', 'CR-Fitchburg'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_route_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"direction_id":"<integer>","route_id":"<string>"}'
```

### get_stop_departures

Retrieve real-time departure predictions and scheduled departures for a specific stop. Returns upcoming departures with arrival/departure times, trip headsigns, direction, and route information. Results are ordered by departure time.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `stop_id` | string | Yes | Stop ID from get_route_details stop_tree (e.g. 'place-sstat' for South Station, 'place-harsq' for Harvard). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_stop_departures \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stop_id":"<string>"}'
```

### get_stop_info

Retrieve detailed information about a specific stop or station including accessibility features, parking lots with capacity and pricing, fare facilities, bike storage, child stop IDs, and geographic coordinates.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `stop_id` | string | Yes | Stop ID from get_route_details stop_tree (e.g. 'place-sstat' for South Station). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_stop_info \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stop_id":"<string>"}'
```

### get_subway_lines

Retrieve all MBTA subway lines. Returns each line's ID, display name, and schedule URL. The subway network includes Red, Orange, Blue, Green, and Mattapan lines.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-mbta-com-api-9ff80d68/get_subway_lines \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```
