# Order flights (/docs/api-reference/flights/create-order)

`POST /v1/flights/order`

Places and pays for flight bookings, one fare per item.

Takes the same body as quote, with `inputs` required. Requires an `Idempotency-Key` header (a new UUID
per purchase) and an API key with order-manage permission. Repeating the same request with the same key returns
the original order; while the first request is still running the response is 409 / 12002 with
`Retry-After`, after which you send the same request again. The order is paid from your
wallet balance and ticketing completes asynchronously: track it with `GET /orders/{id}` or the
`order.fulfillment.updated` webhook.
            
`publicId` is a fare's `publicId` from search, or one that a quote returned. `inputs.passengers`
lists every passenger of the fare exactly once, in `passengerIndex` order 1 to N, optionally with seats in
`selectedSeats`; paid baggage and other services go in `inputs.selectedServices`. Seats and services
are checked against the airline's current offer and seat map, and their prices are added to the item's price.
            
Each item is priced again with the airline before payment, and the price is capped. With the optional
`inputs.maxPrice`, in the order currency, a higher price for the item (the fare with its paid extras) gives
409 / 11002 at `items[i].inputs.maxPrice`. Without it, the fare may not cost more than the price returned
with the `publicId` (409 / 11002 at `items[i]`), and the order must be in the currency of that price
(400 / 11005 at `items[i]`).
A `publicId` keeps that price: after 409 / 11002, quote again and order with the `publicId` the quote
returns, or send `inputs.maxPrice`.
            
Each item is checked completely before the next one, and the first failure names its item: an invalid input or
missing `inputs` gives 400 / 10001 at its path under `items[i]`, for example
`items[0].inputs.passengers[0].email`; an unknown, expired or another partner's `publicId`
400 / 11004 at `items[i]`; an offer the airline no longer sells 409 / 11003 at `items[i]`. A wallet
charge that fails gives 402 / 16000, with `details[0]` naming `wallet` and
`INSUFFICIENT_BALANCE` or `WALLET_BLOCKED`; send the same request with the same key after a top-up.
Nothing is created or charged when the order is refused.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | yes | `string` | UUID idempotency key for safe retries of this operation. |

## Request body

- `application/json`: `FlightOrderRequest`
- `text/json`: `FlightOrderRequest`
- `application/*+json`: `FlightOrderRequest`

## Responses

### 200

OK

- `text/plain`: `FlightOrder`
- `application/json`: `FlightOrder`
- `text/json`: `FlightOrder`

### 400

Invalid partner request or model validation failure.

- `application/json`: `ErrorResponse`

### 402

Payment Required

- `text/plain`: `ErrorResponse`
- `application/json`: `ErrorResponse`
- `text/json`: `ErrorResponse`

### 409

The offer changed since it was quoted: its price rose (11002, for products that check the quoted price) or it is no longer available (11003). Or the idempotency key: a request with this key is still running (12002): send the same request, key and body again after Retry-After seconds; it was used for a different request (12001); or its history is ambiguous.

- `application/json`: `ErrorResponse`

### 429

Too many requests from this IP address. Wait for Retry-After seconds, then send the same request again; an order keeps its Idempotency-Key and body.

- `application/json`: `ErrorResponse`

### 503

Idempotency state is temporarily unavailable; retry the same request and key.

- `application/json`: `ErrorResponse`

The full schemas are in the OpenAPI specification at /openapi.json.