---
title: "Oag Lookup Flight"
method: POST
path: "/bookings/{booking_id}/oag-lookup"
tags: ["bookings"]
---

# Oag Lookup Flight

`POST /bookings/{booking_id}/oag-lookup`

Non-destructive OAG auto-fill for the flight edit form.

Given the in-progress edit, enrich every segment that has a flight number +
departure date with OAG schedule data (departure/arrival times, duration,
terminals, aircraft, …) and return the enriched flight WITHOUT persisting.
The client merges the response into the form for the user to review, then
saves via PATCH. Ownership is required so this can't be used as an open OAG
proxy.

## 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

- ExtractedFlightOutput — 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.dev/stardrift/apis/fastapi/revisions/6ea721316081?raw)
