# Justfly — 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 flights and get airport suggestions to find the best deals on JustFly.com, with instant access to flight details and trending destinations. Discover discounted airfare offers and compare flight options all in one place.

**Category:** Travel | **Website:** [justfly.com/](https://justfly.com/) | **Docs:** [parse.bot/marketplace/2c45632a-4e99-40ce-8cea-9551671e269a/justfly-com-api](https://parse.bot/marketplace/2c45632a-4e99-40ce-8cea-9551671e269a/justfly-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-justfly-com-api-2c45632a/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### autocomplete_airport

Search for airports and cities by query string. Returns matching airports with IATA codes, city names, countries, and coordinates. Results include both city-level matches (with child airports) and individual airport matches.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Search query for airport or city name (e.g. 'New York', 'LAX', 'London') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-justfly-com-api-2c45632a/autocomplete_airport \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

### get_flight_details

Retrieve full details for a specific flight package including fare family options. Uses the search_id and package_id from search_flights results. The search_id must reference a recent search that is still cached on the upstream server.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `encryption_key` | string | Yes | Encryption key from login response |
| `package_id` | string | Yes | Package ID (key from packages object in search_flights response) |
| `search_id` | string | Yes | Search ID returned in search_flights response (32-character hex string) |
| `session_id` | string | Yes | Session ID from login response |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-justfly-com-api-2c45632a/get_flight_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"encryption_key":"<string>","package_id":"<string>","search_id":"<string>","session_id":"<string>"}'
```

### get_trending_destinations

Get trending flight deals for a given origin airport. Returns cheapest roundtrip deals with pricing and travel dates.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Maximum number of deals to return. |
| `origin` | string | No | Origin airport or city IATA code (e.g. 'NYC', 'LAX', 'SFO'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-justfly-com-api-2c45632a/get_trending_destinations \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","origin":"<string>"}'
```

### search_flights

Search for flights between origin and destination on specific dates. Returns a search_id and a list of flight packages with pricing, segments, and baggage info. Polls the upstream search API until results are complete, which may take up to 40 seconds. Use search_id and package_id from results to get flight details via get_flight_details.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `adults` | integer | No | Number of adult passengers. |
| `departure_date` | string | Yes | Departure date in YYYY-MM-DD format |
| `destination` | string | Yes | Destination airport or city IATA code (e.g. 'LAX', 'MIA', 'LHR') |
| `origin` | string | Yes | Origin airport or city IATA code (e.g. 'NYC', 'JFK', 'SFO') |
| `return_date` | string | No | Return date in YYYY-MM-DD format. Required when trip_type is 'roundtrip'. |
| `seat_class` | string | No | Cabin class: 'Economy', 'PremiumEconomy', 'Business', 'First'. |
| `trip_type` | string | No | Trip type: 'roundtrip' or 'oneway'. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-justfly-com-api-2c45632a/search_flights \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"adults":"<integer>","departure_date":"<string>","destination":"<string>","origin":"<string>","return_date":"<string>","seat_class":"<string>","trip_type":"<string>"}'
```
