# Megabus — 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.

> Search for coach trips and compare fares across Megabus UK routes, view available stops and route information, and check real-time seat availability and fare calendars. Retrieve cheapest-price calendars and vacancy data across multiple departure dates and destinations.

**Category:** Travel | **Website:** [megabus.com/](https://megabus.com/) | **Docs:** [parse.bot/marketplace/d2e8334e-4ba2-40e5-b52b-41075742595c/megabus-com-api](https://parse.bot/marketplace/d2e8334e-4ba2-40e5-b52b-41075742595c/megabus-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-megabus-com-api-d2e8334e/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_cheapest_prices_calendar

Check the cheapest prices for a specific route across multiple dates. Returns only dates that have available service; dates without trips are omitted. Useful for finding the best travel date on a route.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `departure_dates` | string | Yes | JSON array of dates in YYYY-MM-DD format (e.g. ["2026-06-20","2026-06-21"]), or a single date in YYYY-MM-DD format. |
| `destination` | string | Yes | Destination Distribusion city code (e.g. GBLON, GBMAN, GBEDIN). |
| `origin` | string | Yes | Origin Distribusion city code (e.g. GBLON, GBMAN, GBEDIN). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-megabus-com-api-d2e8334e/get_cheapest_prices_calendar \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"departure_dates":"<string>","destination":"<string>","origin":"<string>"}'
```

### get_route_guides

Retrieve all available route guides with service numbers, timetable URLs, departure/destination cities, and seasonal date ranges. Returns the full set of Megabus UK route guides.

**Estimated cost:** Metered

_No parameters required._

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

### get_stops_list

Retrieve the full list of available Megabus UK stops with station codes, coordinates, and SSR flags. Stop codes from this endpoint are used for get_trip_vacancy station parameters, not for search_trips origin/destination.

**Estimated cost:** Metered

_No parameters required._

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

### get_trip_vacancy

Check vacancy and pricing details for a specific connection. Station codes are from the Distribusion system (e.g. GBLONVSA, GBMANCBS). All parameters must refer to a future departure. Returns whether the trip is vacant, total/original price, included fees, and required booking attributes.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `arrival_date` | string | Yes | Arrival date in YYYY-MM-DD format. |
| `arrival_station` | string | Yes | Arrival station code (e.g. GBMANCBS for Manchester Coach Station). |
| `arrival_time` | string | Yes | Arrival time in HH:mm format (e.g. 07:35). |
| `carrier_code` | string | Yes | Marketing carrier code (e.g. NEXP for National Express/Megabus). |
| `departure_date` | string | Yes | Departure date in YYYY-MM-DD format. Must be a future date. |
| `departure_station` | string | Yes | Departure station code (e.g. GBLONVSA for London Victoria). |
| `departure_time` | string | Yes | Departure time in HH:mm format (e.g. 02:00). |
| `fare_class` | string | No | Fare class code. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-megabus-com-api-d2e8334e/get_trip_vacancy \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"arrival_date":"<string>","arrival_station":"<string>","arrival_time":"<string>","carrier_code":"<string>","departure_date":"<string>","departure_station":"<string>","departure_time":"<string>","fare_class":"<string>"}'
```

### search_trips

Search for available coach trips between two cities on a specific date. Returns detailed trip info including times, duration, prices, and seat availability. Uses Distribusion city codes (e.g. GBLON, GBMAN). Each trip includes fares with fare class details and carrier name.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `departure_date` | string | Yes | Departure date in YYYY-MM-DD format. Must be a current or future date. |
| `destination` | string | Yes | Destination Distribusion city code (e.g. GBLON for London, GBMAN for Manchester, GBEDIN for Edinburgh). |
| `origin` | string | Yes | Origin Distribusion city code (e.g. GBLON for London, GBMAN for Manchester, GBEDIN for Edinburgh). |
| `pax` | integer | No | Number of passengers (1-9). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-megabus-com-api-d2e8334e/search_trips \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"departure_date":"<string>","destination":"<string>","origin":"<string>","pax":"<integer>"}'
```
