# FlightConnections.com - API Flow

> Captured 2026-04-07 from HAR file. User flow: Homepage -> Select DFW -> View destinations -> Select MAD -> View flight calendar for American Airlines.

## User Flow Summary

```
Homepage (flightconnections.com/)
  |
  |-- User types "d", "dfw" in airport search
  |   GET autocomplete_location.php?term=d     -> returns DFW, DXB, DEN + countries
  |   GET autocomplete_location.php?term=dfw   -> returns DFW (id=2138)
  |
  |-- User selects DFW -> navigates to /flights-from-dallas-fort-worth-dfw
  |   GET aircrafts_url.php?depAps=2138   -> 45 aircraft types (filter options)
  |   GET airlines_url.php?depAps=2138    -> 34 airlines (filter options)
  |   Map tiles load showing all destinations from DFW
  |
  |-- User selects Madrid (MAD, id=186) -> /flights-from-dfw-to-mad
  |   POST validity.php  dep=2138 & des=186 & id=300 (AA)
  |   -> Returns 19 schedule entries for AA flight 36 (DFW->MAD)
  |   -> Calendar datepicker renders available dates
```

---

## API Endpoints

### 1. Airport Autocomplete

```
GET https://www.flightconnections.com/autocomplete_location.php
```

| Param  | Type   | Example | Description           |
|--------|--------|---------|-----------------------|
| `lang` | string | `en`    | Language               |
| `term` | string | `dfw`   | Search term (as-you-type) |

**Response:**
```json
{
  "airports": [
    {
      "value": "DFW - Dallas-Fort Worth",
      "airport": "Dallas-Fort Worth (DFW)",
      "id": "2138"
    }
  ],
  "countries": [
    { "name": "Denmark", "code": "DK", "id": "57" }
  ],
  "continents": []
}
```

- Returns airports, countries, and continents matching the search term
- Airport `id` is the internal numeric identifier used in all subsequent calls

---

### 2. Airlines Filter List

```
GET https://www.flightconnections.com/airlines_url.php
```

| Param    | Type   | Example | Description                |
|----------|--------|---------|----------------------------|
| `lang`   | string | `en`    | Language                    |
| `ids`    | string | (empty) | Filter by airline IDs       |
| `cl`     | string | (empty) | Class filter                |
| `depAps` | int    | `2138`  | Departure airport ID        |
| `desAps` | int    | (empty) | Destination airport ID      |

**Response:** HTML fragment of `<div>` elements, each with:
- `id` - internal airline ID (e.g. `300` = American Airlines)
- `data-name` - airline name
- `data-iata` - IATA code
- `data-fleet` - comma-separated aircraft type IDs
- CSS classes: `cl-f` (first), `cl-b` (business), `cl-p` (premium economy), `cl-e` (economy)

**Airlines serving DFW (34 total):**
Aerolineas Argentinas (AR), Aeromexico (AM), Air Canada (AC), Air France (AF), Alaska (AS), American Airlines (AA), Avelo Airlines (XP), Avianca (AV), Breeze Airways (MX), British Airways (BA), Cathay Pacific (CX), Contour Aviation (LF), Delta (DL), Emirates (EK), EVA Air (BR), Fiji Airways (FJ), Finnair (AY), Frontier Airlines (F9), Iberia (IB), Japan Airlines (JL), JetBlue (B6), Key Lime Air (KG), Korean Air (KE), Lufthansa (LH), Qantas (QF), Qatar Airways (QR), Royal Jordanian (RJ), Southern Airways Express (9X), Spirit Airlines (NK), Sun Country Airlines (SY), Turkish Airlines (TK), United Airlines (UA), VivaAerobus (VB), Volaris (Y4)

---

### 3. Aircraft Filter List

```
GET https://www.flightconnections.com/aircrafts_url.php
```

| Param    | Type   | Example | Description                |
|----------|--------|---------|----------------------------|
| `lang`   | string | `en`    | Language                    |
| `ids`    | string | (empty) | Filter by aircraft IDs      |
| `cl`     | string | (empty) | Class filter                |
| `depAps` | int    | `2138`  | Departure airport ID        |
| `desAps` | int    | (empty) | Destination airport ID      |

**Response:** HTML fragment of `<div>` elements, each with:
- `id` - e.g. `ac-44` (Boeing 777-200)
- `data-name` - aircraft name
- `data-code` - ICAO type code
- `data-id` - internal aircraft ID
- `data-airlines` - comma-separated airline IDs that operate this type
- `data-alliances` - alliance IDs

**45 aircraft types** serving DFW including A220, A319, A320neo, A321neo, 737 MAX, 777-200, 787-9, etc.

---

### 4. Flight Schedule / Calendar Data

```
POST https://www.flightconnections.com/validity.php
Content-Type: application/x-www-form-urlencoded
```

| Param       | Type   | Example | Description                    |
|-------------|--------|---------|--------------------------------|
| `dep`       | int    | `2138`  | Departure airport ID (DFW)     |
| `des`       | int    | `186`   | Destination airport ID (MAD)   |
| `id`        | int    | `300`   | Airline ID (American Airlines) |
| `startDate` | int    | `2026`  | Start year                     |
| `endDate`   | int    | `2027`  | End year                       |
| `lang`      | string | `en`    | Language                       |

**Response:**
```json
{
  "airline": "American Airlines",
  "flights": [
    {
      "flightnumber": "AA  36",
      "ac_id": "44",
      "aircraft": "Boeing 777-200",
      "deptime": "16:45:00",
      "destime": "09:05:00",
      "datefrom": "2026-04-07",
      "dateto": "2026-05-06",
      "su": "0", "mo": "0", "tu": "1", "we": "1",
      "th": "0", "fr": "0", "sa": "0",
      "classes": "0111"
    }
  ]
}
```

**Flight fields:**
| Field          | Description                                              |
|----------------|----------------------------------------------------------|
| `flightnumber` | Flight number (e.g. "AA  36")                            |
| `ac_id`        | Aircraft type ID (maps to aircrafts_url.php)             |
| `aircraft`     | Aircraft name                                            |
| `deptime`      | Departure time (local)                                   |
| `destime`      | Arrival time (local)                                     |
| `datefrom`     | Schedule validity start date                             |
| `dateto`       | Schedule validity end date                               |
| `su`-`sa`      | Day-of-week flags ("1" = operates, "0" = does not)       |
| `classes`      | 4-char string: First/Business/PremEcon/Economy ("0"/"1") |

**DFW -> MAD captured schedule (AA 36, 19 entries):**

| Depart | Arrive | Dates                    | Days of Week         | Aircraft      |
|--------|--------|--------------------------|----------------------|---------------|
| 16:45  | 09:05  | 2026-04-07 to 2026-05-06 | Tu We               | Boeing 777-200 |
| 16:45  | 09:05  | 2026-04-09 to 2026-05-04 | Su Mo Th Fr Sa       | Boeing 777-200 |
| 17:20  | 09:35  | 2026-05-07 to 2026-05-18 | Su Mo Th Fr Sa       | Boeing 777-200 |
| 17:20  | 09:35  | 2026-05-12 to 2026-05-20 | Tu We               | Boeing 777-200 |
| 16:40  | 09:05  | 2026-05-21 to 2026-06-29 | Su Mo Th Fr Sa       | Boeing 777-200 |
| 16:40  | 09:05  | 2026-05-26 to 2026-07-01 | Tu We               | Boeing 777-200 |
| 16:55  | 09:05  | 2026-07-02 to 2026-10-23 | Su Mo Th Fr Sa       | Boeing 777-200 |
| 16:55  | 09:05  | 2026-07-07 to 2026-10-21 | Tu We               | Boeing 777-200 |
| 18:10  | 09:20  | 2026-10-24 to 2026-10-24 | Sa (DST transition)  | Boeing 777-200 |
| 18:20  | 09:20  | 2026-10-25 to 2026-10-31 | Su Tu Th Fr Sa       | Boeing 777-200 |
| 18:20  | 09:20  | 2026-10-26 to 2026-10-28 | Mo We               | Boeing 777-200 |
| 17:20  | 09:20  | 2026-11-01 to 2026-12-01 | Su Tu Th Fr Sa       | Boeing 777-200 |
| 17:20  | 09:20  | 2026-11-02 to 2026-11-30 | Mo We               | Boeing 777-200 |
| 17:20  | 09:20  | 2026-12-02 to 2027-03-03 | Mo We               | Boeing 787-9   |
| 17:20  | 09:20  | 2026-12-03 to 2027-03-02 | Su Tu Th Fr Sa       | Boeing 787-9   |
| 17:20  | 09:20  | 2027-03-04 to 2027-03-13 | Su Tu Th Fr Sa       | Boeing 777-200 |
| 17:20  | 09:20  | 2027-03-08 to 2027-03-10 | Mo We               | Boeing 777-200 |
| 18:20  | 09:20  | 2027-03-14 to 2027-03-27 | Su Tu Th Fr Sa       | Boeing 777-200 |
| 18:20  | 09:20  | 2027-03-15 to 2027-03-24 | Mo We               | Boeing 777-200 |

---

## URL Patterns

| Page                   | URL Pattern                                         |
|------------------------|-----------------------------------------------------|
| Homepage               | `https://www.flightconnections.com/`                |
| Flights from airport   | `/flights-from-dallas-fort-worth-dfw`               |
| Flights between cities | `/flights-from-dfw-to-mad`                          |

---

## Map Tiles

```
GET https://cdn.flightconnections.com/maptiles/en/{z}/{x}/{y}.webp
GET https://cdn.flightconnections.com/maptiles/en/{z}/{x}/{y}@2x.webp   (retina)
```

Custom map tiles showing airport locations and route lines. Zoom level 2 tiles observed in this capture.

---

## Third-Party Services (ads/analytics)

| Domain                            | Purpose                |
|-----------------------------------|------------------------|
| `compare.flightconnections.com`   | Ad serving (ClickTripz integration) |
| `compare.flightconnections.com/x/pas` | Partner ad auction |
| `compare.flightconnections.com/c11g`  | Ad slot configuration |
| `compare.flightconnections.com/b9s`   | Event logging     |

---

## Key Internal IDs

| Entity           | ID     |
|------------------|--------|
| DFW airport      | `2138` |
| MAD airport      | `186`  |
| American Airlines| `300`  |
| Boeing 777-200   | `44`   |
| Boeing 787-9     | `59`   |
