Skip to main content

Create a flight booking

curl -X POST "http://localhost:3000/v1/flight/booking" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "flightId": "flight_abc123",
    "bookingCode": "ABC123",
    "seatNumber": "12A",
    "seatType": "window",
    "seatingClass": "economy",
    "reason": "personal",
    "notes": "Window seat preferred"
  }'
POST
/v1/flight/booking
Create a new booking for a flight with booking details

Request body

flightId
string
required
Flight ID to associate the booking withExample: flight_abc123
bookingCode
string
Booking code/confirmation code (max 50 characters)Example: ABC123
seatNumber
string
Seat number (max 10 characters)Example: 12A
seatType
string
Type of seat positionOptions: window, middle, aisle, jumpseat, captain, pilot, copilot, flight_engineer, flight_attendant, observer, otherExample: window
seatingClass
string
Class of serviceOptions: economy, premium_economy, business, first, private, otherExample: economy
reason
string
default:"personal"
Reason for the flightOptions: personal, business, crew, training, repositioning, otherExample: personal
notes
string
Additional notes about the booking (max 500 characters)Example: Window seat preferred

Response

id
string
Unique booking identifierExample: booking_abc123
bookingCode
string
Booking code/confirmation code
seatNumber
string
Seat number
seatType
string
Type of seat position
seatingClass
string
Class of service
reason
string
Reason for the flight
notes
string
Additional notes about the booking
flightId
string
Flight ID associated with this booking
userId
string
User ID who owns this booking
createdAt
string
Date and time when the booking was created (ISO 8601)Example: 2024-03-20T10:00:00Z
updatedAt
string
Date and time when the booking was last updated (ISO 8601)Example: 2024-03-20T10:00:00Z

Response example

{
  "id": "booking_abc123",
  "bookingCode": "ABC123",
  "seatNumber": "12A",
  "seatType": "window",
  "seatingClass": "economy",
  "reason": "personal",
  "notes": "Window seat preferred",
  "flightId": "flight_abc123",
  "userId": "user_abc123",
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-20T10:00:00Z"
}

Error responses

400
object
Invalid request parameters or flight not found
{
  "message": "Flight not found"
}
401
object
User is not authenticated
{
  "message": "Unauthorized"
}
500
object
Internal server error
{
  "message": "Internal server error"
}

Get a flight booking

curl -X GET "http://localhost:3000/v1/flight/booking/booking_abc123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/v1/flight/booking/{bookingId}
Get details of a specific flight booking

Path parameters

bookingId
string
required
ID of the booking to retrieveExample: booking_abc123

Response

Returns a booking object with the same structure as the create booking response.

Error responses

401
object
User is not authenticated
404
object
Booking not found
{
  "message": "Booking not found"
}
500
object
Internal server error

Update a flight booking

curl -X PUT "http://localhost:3000/v1/flight/booking/booking_abc123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "seatNumber": "14B",
    "seatType": "aisle",
    "notes": "Changed to aisle seat"
  }'
PUT
/v1/flight/booking/{bookingId}
Update an existing flight booking

Path parameters

bookingId
string
required
ID of the booking to updateExample: booking_abc123

Request body

All fields are optional. Only include the fields you want to update. Set to null to clear a field.
bookingCode
string | null
Booking code/confirmation code (max 50 characters). Set to null to clear.
seatNumber
string | null
Seat number (max 10 characters). Set to null to clear.
seatType
string | null
Type of seat position. Set to null to clear.Options: window, middle, aisle, jumpseat, captain, pilot, copilot, flight_engineer, flight_attendant, observer, other
seatingClass
string | null
Class of service. Set to null to clear.Options: economy, premium_economy, business, first, private, other
reason
string | null
Reason for the flight. Set to null to clear.Options: personal, business, crew, training, repositioning, other
notes
string | null
Additional notes about the booking (max 500 characters). Set to null to clear.

Response

Returns the updated booking object.

Error responses

400
object
Invalid request parameters
401
object
User is not authenticated
404
object
Booking not found
500
object
Internal server error

Delete a flight booking

curl -X DELETE "http://localhost:3000/v1/flight/booking/booking_abc123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
DELETE
/v1/flight/booking/{bookingId}
Delete a flight booking

Path parameters

bookingId
string
required
ID of the booking to deleteExample: booking_abc123

Response

{
  "message": "Booking deleted successfully"
}

Error responses

401
object
User is not authenticated
404
object
Booking not found
500
object
Internal server error

Get all bookings for a flight

curl -X GET "http://localhost:3000/v1/flight/booking/flight/flight_abc123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/v1/flight/booking/flight/{flightId}
Get all bookings associated with a specific flight

Path parameters

flightId
string
required
ID of the flightExample: flight_abc123

Response

Returns an array of booking objects.
[
  {
    "id": "booking_abc123",
    "bookingCode": "ABC123",
    "seatNumber": "12A",
    "seatType": "window",
    "seatingClass": "economy",
    "reason": "personal",
    "notes": "Window seat preferred",
    "flightId": "flight_abc123",
    "userId": "user_abc123",
    "createdAt": "2024-03-20T10:00:00Z",
    "updatedAt": "2024-03-20T10:00:00Z"
  },
  {
    "id": "booking_def456",
    "bookingCode": "DEF456",
    "seatNumber": "12B",
    "seatType": "middle",
    "seatingClass": "economy",
    "reason": "personal",
    "flightId": "flight_abc123",
    "userId": "user_def456",
    "createdAt": "2024-03-20T11:00:00Z",
    "updatedAt": "2024-03-20T11:00:00Z"
  }
]

Error responses

400
object
Flight not found
401
object
User is not authenticated
500
object
Internal server error

Build docs developers (and LLMs) love