---
title: "Update Flight Booking"
method: PATCH
path: "/bookings/{booking_id}"
tags: ["bookings"]
---

# Update Flight Booking

`PATCH /bookings/{booking_id}`

Apply user corrections to an imported flight booking.

Writes the edited ExtractedFlight into raw_data["data"] — preserving the
email_metadata/folded_from envelope via spread — marks the row user_edited
so a later re-scan/merge keeps the human values on conflict
(merge_or_judge's "current" conflict policy), and re-derives the
denormalized event_date + confirmation_number columns that drive list
ordering and the conf label.

## Path parameters

- `booking_id` string, uuid, required

## Request body

- ExtractedFlightInput — Complete flight booking extracted from user message. For one-way: all segments in outbound_segments, return_segments empty For round-trip: outbound_segments has flights TO destination, return_segments has flights BACK from destination
  - `type` 'one-way' | 'round-trip'
  - `outbound_segments` ExtractedFlightSegment[], required — Segments going TO the destination
    - `departure_airport` string, required — 3-letter IATA code (e.g., 'SFO')
    - `arrival_airport` string, required — 3-letter IATA code (e.g., 'JFK')
    - `departure_datetime` string, date-time, required — Departure date and time (local time, no timezone)
    - `arrival_datetime` string, date-time, nullable — Arrival date and time (local time, no timezone)
    - `duration_minutes` integer, nullable — Flight duration in minutes if mentioned (e.g., '16h 35m' = 995)
    - `flight_number` string, nullable — Flight number (e.g., 'UA123')
    - `airline` string, nullable — Airline name
    - `cabin_class` string, nullable — Cabin class (e.g., 'Economy', 'Premium Economy', 'Business', 'First')
    - `seat` string, nullable — Seat assignment if shown (e.g., '14A', '2K')
    - `aircraft_type_iata` string, nullable — IATA aircraft type code (e.g., '77W', '320')
    - `aircraft_type_icao` string, nullable — ICAO aircraft type code (e.g., 'B77W', 'A320')
    - `tail_number` string, nullable — Aircraft registration number (e.g., 'N12345')
    - `departure_terminal` string, nullable — Departure terminal (e.g., 'T1', 'B')
    - `arrival_terminal` string, nullable — Arrival terminal
    - `departure_country` string, nullable — Departure country ISO code (e.g., 'US')
    - `arrival_country` string, nullable — Arrival country ISO code (e.g., 'GB')
    - `distance_km` number, nullable — Great-circle distance in kilometers
    - `number_of_stops` integer, nullable — Number of intermediate stops (0 for non-stop)
    - `flight_state` string, nullable — Flight state from OAG (e.g., 'Scheduled', 'InGate', 'Cancelled')
    - `pre_oag_departure_datetime` string, date-time, nullable — The ticket's own departure time, recorded the first time OAG touches this segment and never overwritten — the recovery value if an enrichment adjusts wrongly.
    - `pre_oag_arrival_datetime` string, date-time, nullable — The ticket's own arrival time; see pre_oag_departure_datetime.
    - `departure_datetime_utc` string, date-time, nullable — Authoritative departure instant from OAG, timezone-aware UTC. The naive departure_datetime stays local wall-clock at the airport.
    - `arrival_datetime_utc` string, date-time, nullable — Authoritative arrival instant from OAG, timezone-aware UTC. The naive arrival_datetime stays local wall-clock at the airport.
  - `return_segments` ExtractedFlightSegment[] — Segments coming BACK from destination (empty for one-way)
    - `departure_airport` string, required — 3-letter IATA code (e.g., 'SFO')
    - `arrival_airport` string, required — 3-letter IATA code (e.g., 'JFK')
    - `departure_datetime` string, date-time, required — Departure date and time (local time, no timezone)
    - `arrival_datetime` string, date-time, nullable — Arrival date and time (local time, no timezone)
    - `duration_minutes` integer, nullable — Flight duration in minutes if mentioned (e.g., '16h 35m' = 995)
    - `flight_number` string, nullable — Flight number (e.g., 'UA123')
    - `airline` string, nullable — Airline name
    - `cabin_class` string, nullable — Cabin class (e.g., 'Economy', 'Premium Economy', 'Business', 'First')
    - `seat` string, nullable — Seat assignment if shown (e.g., '14A', '2K')
    - `aircraft_type_iata` string, nullable — IATA aircraft type code (e.g., '77W', '320')
    - `aircraft_type_icao` string, nullable — ICAO aircraft type code (e.g., 'B77W', 'A320')
    - `tail_number` string, nullable — Aircraft registration number (e.g., 'N12345')
    - `departure_terminal` string, nullable — Departure terminal (e.g., 'T1', 'B')
    - `arrival_terminal` string, nullable — Arrival terminal
    - `departure_country` string, nullable — Departure country ISO code (e.g., 'US')
    - `arrival_country` string, nullable — Arrival country ISO code (e.g., 'GB')
    - `distance_km` number, nullable — Great-circle distance in kilometers
    - `number_of_stops` integer, nullable — Number of intermediate stops (0 for non-stop)
    - `flight_state` string, nullable — Flight state from OAG (e.g., 'Scheduled', 'InGate', 'Cancelled')
    - `pre_oag_departure_datetime` string, date-time, nullable — The ticket's own departure time, recorded the first time OAG touches this segment and never overwritten — the recovery value if an enrichment adjusts wrongly.
    - `pre_oag_arrival_datetime` string, date-time, nullable — The ticket's own arrival time; see pre_oag_departure_datetime.
    - `departure_datetime_utc` string, date-time, nullable — Authoritative departure instant from OAG, timezone-aware UTC. The naive departure_datetime stays local wall-clock at the airport.
    - `arrival_datetime_utc` string, date-time, nullable — Authoritative arrival instant from OAG, timezone-aware UTC. The naive arrival_datetime stays local wall-clock at the airport.
  - `price` number, nullable — Total cash price if mentioned (null if fully award-booked)
  - `currency` string — ISO 4217 currency code (e.g., USD, EUR, JPY)
  - `award` AwardPayment — Payment made with loyalty miles/points.
    - `amount` integer, nullable — Number of miles/points used (e.g., 800, 25000)
    - `unit` 'miles' | 'points', required — 'miles' or 'points'
    - `account` string, nullable — Loyalty account identifier if shown (e.g., 'MileagePlus XXXXX205', 'Bonvoy XXXX1234')
  - `confirmation_number` string, nullable
  - `booking_reference` string, nullable — Airline PNR / record locator (6-char alphanumeric, e.g., 'ABCDEF'). Different from confirmation_number which may be an OTA/agent booking code.
  - `eticket_number` string, nullable — E-ticket number (typically 13 digits, e.g., '0012345678901')
  - `fare_class` string, nullable — Fare/booking class letter (e.g., 'Y', 'B', 'J', 'W')
  - `checked_bags` integer, nullable — Number of checked bags included or purchased
  - `carry_on_bags` integer, nullable — Number of carry-on bags included
  - `check_in_url` string, nullable — Online check-in URL if present in the email
  - `oag_enriched_at` string, nullable — ISO timestamp when OAG enrichment was applied
  - `passenger_count` integer, nullable — Number of adult passengers on this booking (e.g., 2 passengers)
  - `passenger_names` string[] — Names of passengers if listed (e.g., ['John Smith', 'Jane Smith'])
  - `children` integer, nullable — Number of child passengers (aged 2-11)
  - `infants` integer, nullable — Number of infant passengers (under 2)

## Response `200`

Successful Response

- FlightBookingItem
  - `id` string, required
  - `event_date` string, nullable, required
  - `created_at` string, required
  - `confirmation_number` string, nullable, required
  - `status` 'active' | 'cancelled'
  - `gmail_link` string, nullable
  - `import_kind` 'email' | 'image' | 'text', nullable
  - `import_link` string, nullable
  - `import_sources` ImportSource[]
    - `kind` 'email' | 'image' | 'text', required
    - `link` string, nullable
    - `created_at` string, date-time, required
  - `source` 'email_import' | 'first_party'
  - `trip_id` string, nullable
  - `trip_title` string, nullable
  - `review` BookingReview
    - `question` 'which_trip' | 'is_this_yours', required
    - `travelers` string[]
    - `nudge` boolean
  - `booking_type` 'flight'
  - `card_data` FlightCardData, required — Flight card data for frontend - wraps Journey with card metadata. This is the serialization format sent to the frontend FlightCard component. It converts from the internal Journey model to the frontend contract.
    - `type` 'one-way' | 'round-trip' | 'multi-city', required
    - `journeys` ApiModelsFlightCardJourneyDisplay[], required
      - `direction` 'outbound' | 'return', nullable
      - `segments` SegmentDisplay[], required
        - `kind` 'flight'
        - `type` 'outbound' | 'return', nullable
        - `departure` ApiModelsFlightCardDepartureArrivalDisplay, required — Frontend format for departure/arrival points. `timezone` (IANA) and the coordinates come from the airport catalog when the journey endpoint itself has none, so a consumer can compute the offset crossed and the direction flown without its own airport table.
          - `time` string, date-time, required
          - `airport` string, required
          - `timezone` string, nullable
          - `latitude` number, nullable
          - `longitude` number, nullable
        - `arrival` ApiModelsFlightCardDepartureArrivalDisplay, required — Frontend format for departure/arrival points. `timezone` (IANA) and the coordinates come from the airport catalog when the journey endpoint itself has none, so a consumer can compute the offset crossed and the direction flown without its own airport table.
          - `time` string, date-time, required
          - `airport` string, required
          - `timezone` string, nullable
          - `latitude` number, nullable
          - `longitude` number, nullable
        - `length_in_minutes` integer, required
        - `flight_number` string, required
        - `airline` string, required
        - `airline_logo` string, nullable
        - `aircraft` string, nullable
        - `travel_class` string, nullable
        - `starlink_verdict` 'yes' | 'probably_yes' | 'probably_no' | 'no', nullable
        - `starlink_reasoning` string, nullable
      - `total_duration_in_minutes` integer, required
      - `departure_date` string, date-time, nullable
      - `arrival_date` string, date-time, nullable
    - `cash_details` ApiModelsFlightCardCashDisplay — Frontend format for cash pricing.
      - `type` 'cash'
      - `price` number, nullable
      - `currency` string
    - `cabin_class` string, nullable
    - `booking_links` BookingLink[], nullable
      - `link` string, required
      - `label` string, required
      - `price` number, nullable
      - `currency` string, nullable
      - `primary` boolean
      - `fare_name` string, nullable
      - `free_carry_on` integer, nullable
      - `free_checked_bags` integer, nullable
    - `adults` integer
    - `children` integer
    - `booking_token` string, nullable
    - `departure_token` string, nullable
    - `return_date` string, nullable
    - `__index` integer, required
    - `__tool_call_id` string, required
    - `message_id` string, nullable
    - `booking_links_status` string, nullable
    - `confirmation_number` string, nullable
    - `is_booked` boolean
    - `is_user_import` boolean
    - `user_edited` boolean
    - `award_details` object, nullable
  - `edit_data` ExtractedFlightOutput, required — Complete flight booking extracted from user message. For one-way: all segments in outbound_segments, return_segments empty For round-trip: outbound_segments has flights TO destination, return_segments has flights BACK from destination
    - `type` 'one-way' | 'round-trip'
    - `outbound_segments` ExtractedFlightSegment[], required — Segments going TO the destination
      - `departure_airport` string, required — 3-letter IATA code (e.g., 'SFO')
      - `arrival_airport` string, required — 3-letter IATA code (e.g., 'JFK')
      - `departure_datetime` string, date-time, required — Departure date and time (local time, no timezone)
      - `arrival_datetime` string, date-time, nullable — Arrival date and time (local time, no timezone)
      - `duration_minutes` integer, nullable — Flight duration in minutes if mentioned (e.g., '16h 35m' = 995)
      - `flight_number` string, nullable — Flight number (e.g., 'UA123')
      - `airline` string, nullable — Airline name
      - `cabin_class` string, nullable — Cabin class (e.g., 'Economy', 'Premium Economy', 'Business', 'First')
      - `seat` string, nullable — Seat assignment if shown (e.g., '14A', '2K')
      - `aircraft_type_iata` string, nullable — IATA aircraft type code (e.g., '77W', '320')
      - `aircraft_type_icao` string, nullable — ICAO aircraft type code (e.g., 'B77W', 'A320')
      - `tail_number` string, nullable — Aircraft registration number (e.g., 'N12345')
      - `departure_terminal` string, nullable — Departure terminal (e.g., 'T1', 'B')
      - `arrival_terminal` string, nullable — Arrival terminal
      - `departure_country` string, nullable — Departure country ISO code (e.g., 'US')
      - `arrival_country` string, nullable — Arrival country ISO code (e.g., 'GB')
      - `distance_km` number, nullable — Great-circle distance in kilometers
      - `number_of_stops` integer, nullable — Number of intermediate stops (0 for non-stop)
      - `flight_state` string, nullable — Flight state from OAG (e.g., 'Scheduled', 'InGate', 'Cancelled')
      - `pre_oag_departure_datetime` string, date-time, nullable — The ticket's own departure time, recorded the first time OAG touches this segment and never overwritten — the recovery value if an enrichment adjusts wrongly.
      - `pre_oag_arrival_datetime` string, date-time, nullable — The ticket's own arrival time; see pre_oag_departure_datetime.
      - `departure_datetime_utc` string, date-time, nullable — Authoritative departure instant from OAG, timezone-aware UTC. The naive departure_datetime stays local wall-clock at the airport.
      - `arrival_datetime_utc` string, date-time, nullable — Authoritative arrival instant from OAG, timezone-aware UTC. The naive arrival_datetime stays local wall-clock at the airport.
    - `return_segments` ExtractedFlightSegment[] — Segments coming BACK from destination (empty for one-way)
      - `departure_airport` string, required — 3-letter IATA code (e.g., 'SFO')
      - `arrival_airport` string, required — 3-letter IATA code (e.g., 'JFK')
      - `departure_datetime` string, date-time, required — Departure date and time (local time, no timezone)
      - `arrival_datetime` string, date-time, nullable — Arrival date and time (local time, no timezone)
      - `duration_minutes` integer, nullable — Flight duration in minutes if mentioned (e.g., '16h 35m' = 995)
      - `flight_number` string, nullable — Flight number (e.g., 'UA123')
      - `airline` string, nullable — Airline name
      - `cabin_class` string, nullable — Cabin class (e.g., 'Economy', 'Premium Economy', 'Business', 'First')
      - `seat` string, nullable — Seat assignment if shown (e.g., '14A', '2K')
      - `aircraft_type_iata` string, nullable — IATA aircraft type code (e.g., '77W', '320')
      - `aircraft_type_icao` string, nullable — ICAO aircraft type code (e.g., 'B77W', 'A320')
      - `tail_number` string, nullable — Aircraft registration number (e.g., 'N12345')
      - `departure_terminal` string, nullable — Departure terminal (e.g., 'T1', 'B')
      - `arrival_terminal` string, nullable — Arrival terminal
      - `departure_country` string, nullable — Departure country ISO code (e.g., 'US')
      - `arrival_country` string, nullable — Arrival country ISO code (e.g., 'GB')
      - `distance_km` number, nullable — Great-circle distance in kilometers
      - `number_of_stops` integer, nullable — Number of intermediate stops (0 for non-stop)
      - `flight_state` string, nullable — Flight state from OAG (e.g., 'Scheduled', 'InGate', 'Cancelled')
      - `pre_oag_departure_datetime` string, date-time, nullable — The ticket's own departure time, recorded the first time OAG touches this segment and never overwritten — the recovery value if an enrichment adjusts wrongly.
      - `pre_oag_arrival_datetime` string, date-time, nullable — The ticket's own arrival time; see pre_oag_departure_datetime.
      - `departure_datetime_utc` string, date-time, nullable — Authoritative departure instant from OAG, timezone-aware UTC. The naive departure_datetime stays local wall-clock at the airport.
      - `arrival_datetime_utc` string, date-time, nullable — Authoritative arrival instant from OAG, timezone-aware UTC. The naive arrival_datetime stays local wall-clock at the airport.
    - `price` number, nullable — Total cash price if mentioned (null if fully award-booked)
    - `currency` string — ISO 4217 currency code (e.g., USD, EUR, JPY)
    - `award` AwardPayment — Payment made with loyalty miles/points.
      - `amount` integer, nullable — Number of miles/points used (e.g., 800, 25000)
      - `unit` 'miles' | 'points', required — 'miles' or 'points'
      - `account` string, nullable — Loyalty account identifier if shown (e.g., 'MileagePlus XXXXX205', 'Bonvoy XXXX1234')
    - `confirmation_number` string, nullable
    - `booking_reference` string, nullable — Airline PNR / record locator (6-char alphanumeric, e.g., 'ABCDEF'). Different from confirmation_number which may be an OTA/agent booking code.
    - `eticket_number` string, nullable — E-ticket number (typically 13 digits, e.g., '0012345678901')
    - `fare_class` string, nullable — Fare/booking class letter (e.g., 'Y', 'B', 'J', 'W')
    - `checked_bags` integer, nullable — Number of checked bags included or purchased
    - `carry_on_bags` integer, nullable — Number of carry-on bags included
    - `check_in_url` string, nullable — Online check-in URL if present in the email
    - `oag_enriched_at` string, nullable — ISO timestamp when OAG enrichment was applied
    - `passenger_count` integer, nullable — Number of adult passengers on this booking (e.g., 2 passengers)
    - `passenger_names` string[] — Names of passengers if listed (e.g., ['John Smith', 'Jane Smith'])
    - `children` integer, nullable — Number of child passengers (aged 2-11)
    - `infants` integer, nullable — Number of infant passengers (under 2)

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/stardrift/apis/fastapi.md) · [All operations](https://skmtc.dev/stardrift/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stardrift/fastapi/revisions/00746572572a/schema)
