💰 Get Fare Options
💰 Get Fare Options
**Get fare options for a specific flight**
This endpoint has two modes:
### **Mode 1: Get fare options from cache (same cabin class)**
When `cabinClass` is NOT provided, returns fare options from cache (same cabin class as initial search).
- Works with flights from recent `/flights/search-unified` calls
- Returns all fare categories (Economy Basic, Economy Value, etc.) for the same cabin class
### **Mode 2: Search for fare options in different cabin class**
When `cabinClass` IS provided, searches PKFare for the same flight but in the requested cabin class.
- **Use case**: User is viewing Economy fare options and wants to see Business class options
- Makes a new search to PKFare with the same flight details but different cabin class
- Returns all fare options for the requested cabin class
### **Request Body**
- **flightHash** (required): Flight hash from search-unified response
- For one-way: Use outbound flight hash
- For round-trip: Use inbound flight hash
- **outboundFlightHash** (optional): Outbound flight hash (for round-trip context)
- **cabinClass** (optional): Requested cabin class (e.g., "business", "first", "premium_economy")
- If provided: Searches PKFare for fare options in this cabin class
- If not provided: Returns fare options from cache (same cabin class)
- **adults** (required when cabinClass is provided): Number of adult passengers
- **children** (optional): Number of child passengers
- **infants** (optional): Number of infant passengers
### **Response**
Returns all fare options for the flight, including:
- **fareOptions**: Array of all available fare options with:
- solutionKey, solutionId
- fareCategory (e.g., "ECONOMY LIGHT", "BUSINESS FLEX")
- pricing (total, base, tax, fees)
- booking rules (refundable, changeable, cancellation/change fees)
- baggage allowances
- amenities (meals, wifi, seat selection)
- Raw PKFare data (miniRulesMap, baggageMap, otherFareRules)
- Flight details (legs, duration, airport change info)
- Backward compatibility fields (cheapest fare option)
### **Example Request 1: Get from cache (same cabin class)**
```json
{
"flightHash": "EK_708_DXB_LHR_1737705600000_1737723000000"
}
```
### **Example Request 2: Search for Business class**
```json
{
"flightHash": "EK_708_DXB_LHR_1737705600000_1737723000000",
"outboundFlightHash": "EK_29_DXB_LHR_1737705600000_1737723000000",
"cabinClass": "business",
"adults": 1
}
```
### **Example Response**
```json
{
"success": true,
"data": {
"flightHash": "EK_708_DXB_LHR_1737705600000_1737723000000",
"totalDuration": 760,
"legs": [...],
"airportChange": false,
"fareOptions": [
{
"solutionKey": "...",
"solutionId": "...",
"fareCategory": "BUSINESS FLEX",
"pricing": {
"total": 4500,
"currency": "AED",
"base": 4000,
"tax": 500
},
"booking": {
"refundable": true,
"changeable": true
},
"baggage": {
"carryOn": { "pieces": 2, "weight": 7 },
"checked": { "pieces": 2, "weight": 32 }
},
"amenities": {
"meals": { "available": true },
"seatSelection": { "available": true }
}
}
],
"solutionKey": "...",
"pricing": { "total": 4500, ... }
}
}
```
### **Error Responses**
- **B037**: Flight data not found in cache - search for flights again
- **B024**: Flight data has expired - search for flights again
- **B038**: No fare options found for requested cabin class
- **P002**: Missing required parameter
