Flight Booking API Documentation
Overview
This API enables flight booking confirmation with full itinerary details, passenger information, and payment preparation. It returns PNR details, fare rules, and order status.
API Endpoint
- URL:
https://api-stag.tripdata.vn/hub/flight/book
- Method:
POST
- Content-Type:
application/json
Key |
Value |
Description |
Authorization |
Bearer {token} |
JWT access token (Required) |
Content-Type |
application/json |
Request/Response format |
Request Body Parameters
Main Parameters
Field |
Type |
Required |
Description |
Example/Values |
Provider |
String |
✅ Yes |
Provider code for booking system |
"provider1" |
Type |
String |
✅ Yes |
Journey type |
ROUND_TRIP , ONE_WAY |
Adults |
Integer |
✅ Yes |
Number of adult passengers (1-9) |
1 |
Children |
Integer |
❌ No |
Number of child passengers (0-8) |
1 |
Infants |
Integer |
❌ No |
Number of infant passengers (0-8) |
1 |
Solution Object
Field |
Type |
Required |
Description |
solutionProvider |
String |
✅ Yes |
Provider ID for the flight solution |
solutionProviderId |
String |
✅ Yes |
Unique solution identifier |
flights |
Array |
✅ Yes |
Array of flight objects (see below) |
Flight Object
Field |
Type |
Required |
Description |
sequence |
Number |
✅ Yes |
Flight segment sequence |
lastTicketTime |
String |
✅ Yes |
Booking deadline (ISO 8601 format) |
segments |
Array |
✅ Yes |
Flight segments (see below) |
Segment Object
Field |
Type |
Required |
Description |
segmentId |
String |
✅ Yes |
Unique segment identifier |
bookingCode |
String |
✅ Yes |
Fare class code |
cabinClass |
String |
✅ Yes |
Cabin class |
departureCode |
String |
✅ Yes |
IATA departure airport code |
arrivalCode |
String |
✅ Yes |
IATA arrival airport code |
departureTime |
String |
✅ Yes |
Local departure time (HH:mm) |
arrivalTime |
String |
✅ Yes |
Local arrival time (HH:mm) |
airlines |
String |
✅ Yes |
2-letter airline code |
Field |
Type |
Required |
Description |
FirstName |
String |
✅ Yes |
Passenger given name |
LastName |
String |
✅ Yes |
Passenger family name |
Type |
Number |
✅ Yes |
Passenger type (1=Adult, 2=Child, 3=Infant) |
DateOfBirth |
String |
✅ Yes |
Birthdate (YYYY-MM-DD) |
IdNumber |
String |
✅ Yes |
Government-issued ID number |
Sample Request
curl --location 'https://api-stag.tripdata.vn/hub/flight/book' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtp...' \
--header 'Content-Type: application/json' \
--data-raw '{
"Provider": "provider1",
"Type": "ROUND_TRIP",
"Adults": 1,
"Children": 1,
"Infants": 1,
"solution": {
"solutionProvider": "provider1",
"solutionProviderId": "mZ63GpgAOYemWEVJo5gj1...",
"flights": [
{
"sequence": 1,
"lastTicketTime": "2025-03-21T20:59:00:0000",
"segments": [
{
"segmentId": "eb2ab42945128bb298ced40142541b92",
"bookingCode": "H",
"cabinClass": "ECONOMY",
"departureCode": "HAN",
"arrivalCode": "SGN",
"departureTime": "14:55",
"arrivalTime": "17:00",
"airlines": "W2"
}
]
}
]
},
"passengers": [
{
"FirstName": "The Vo",
"LastName": "Vo The DacBeo",
"Type": 1,
"DateOfBirth": "1995-03-27",
"IdNumber": "014563322154"
}
]
}'
Sample Response
{
"orderBaseInfo": {
"status": "TO_BE_PAID",
"pnr": "WCDKAF",
"totalAmountUSD": 949.06,
"currency": "USD"
},
"orderFlightInfo": {
"flightSegments": [
{
"departureCode": "HAN",
"arrivalCode": "SGN",
"departureTime": "2025-03-21T14:55:00",
"airlines": "W2",
"flightNumber": "4139"
}
]
},
"passengers": [
{
"firstName": "The Vo",
"lastName": "Vo The DacBeo",
"type": 1,
"ticketStatus": "PENDING"
}
],
"priceInfo": {
"totalAmountVND": 24428804.4,
"priceDetails": [
{
"type": 1,
"totalAmountUSD": 410.68
}
]
}
}
Response Field Description
Field |
Type |
Description |
Possible Values |
status |
String |
Current booking status |
TO_BE_PAID , CONFIRMED |
pnr |
String |
6-character booking reference |
WCDKAF |
totalAmountUSD |
Number |
Total payment amount in USD |
949.06 |
currency |
String |
Settlement currency |
USD , VND |
Field |
Type |
Description |
departureCode |
String |
IATA code of departure airport |
arrivalCode |
String |
IATA code of arrival airport |
departureTime |
String |
ISO 8601 departure timestamp |
airlines |
String |
Operating airline code |
flightNumber |
String |
Carrier flight number |
Passenger Details
Field |
Type |
Description |
firstName |
String |
Passenger's given name |
lastName |
String |
Passenger's family name |
type |
Number |
Passenger category (1=Adult, 2=Child, 3=Infant) |
ticketStatus |
String |
Ticket issuance status |
Price Breakdown
Field |
Type |
Description |
totalAmountVND |
Number |
Total price in Vietnamese Dong |
type |
Number |
Fare type (1=Adult, 2=Child, 3=Infant) |
totalAmountUSD |
Number |
Total price per category in USD |