---
title: "Create a flight search"
description: "Creates a metasearch for the given route/dates/passengers and returns its searchId."
---

> Documentation Index
> Fetch the complete documentation index at: https://agents.wego.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a flight search

`POST /v1/flights/searches`

Creates a metasearch for the given route/dates/passengers and returns its searchId. Results accrue asynchronously – poll getFlightSearchResults with the returned searchId to read ranked trips.

Operation ID: `createFlightSearch`

## Request body

`application/json`

| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
| `from` | string | yes | pattern `^[A-Z]{3}$` | Origin airport or city IATA code, e.g. DXB. |
| `to` | string | yes | pattern `^[A-Z]{3}$` | Destination airport or city IATA code, e.g. LHR. |
| `fromDate` | string | yes | pattern `^\d{4}-\d{2}-\d{2}$` | Outbound departure date, YYYY-MM-DD. Not in the past, within a year. |
| `toDate` | string | no | pattern `^\d{4}-\d{2}-\d{2}$` | Return date, YYYY-MM-DD. Omit for a one-way search. |
| `cabin` | `economy` \| `premium_economy` \| `business` \| `first` | no | default `"economy"` | Cabin class requested for all passengers. |
| `adults` | integer | no | 1..9; default `1` | Adult passengers (1-9). Defaults to 1. Note the hotel search defaults adults to 2, since a room sleeps two. |
| `children` | integer | no | 0..8; default `0` | Child passengers (0-8). Defaults to 0. |
| `infants` | integer | no | 0..8; default `0` | Infant passengers (0-8). Must not exceed adults. Defaults to 0. |
| `currency` | string | no | pattern `^[A-Z]{3}$`; default `"USD"` | Pricing currency as a 3-letter ISO 4217 code. Defaults to USD. |
| `locale` | string | no | length 1..35; default `"en"` | Response language tag (e.g. en, ar). Defaults to en. |
| `siteCode` | string | no | pattern `^[A-Z]{2}$` | Wego market (point of sale) as a 2-letter code, e.g. AE. Optional: if omitted the API defaults to US. A client that knows the user's market (the wego CLI derives it from the id_token) passes it as an explicit siteCode; the response always reports the siteCode used. |



## Responses

| Status | Description |
|---|---|
| `201` | Search created. |
| `400` | Invalid request body/query/path parameters. |
| `401` | Missing or invalid bearer token. |
| `429` | Rate limit exceeded; retry after the `Retry-After` seconds. |
| `502` | The upstream flights service returned an invalid response. |
| `503` | The flights service is temporarily unavailable (`upstream_unavailable`) or rate-limited upstream (`upstream_rate_limited`); retry after the `Retry-After` seconds. |

### `201` body

| Field | Type | Always present | Description |
|---|---|---|---|
| `searchId` | string | yes | The id of the created search; pass it to the results and trip reads. |
| `siteCode` | string | yes | The site code (Wego market) the search was created for. |
| `siteCodeSource` | `explicit` \| `default` | yes | How the API resolved siteCode: explicit (caller-supplied – including a market a client derived and passed) or default (US, no site supplied). |


## Example

```bash
FROM_DATE=$(date -u -v+60d +%F 2>/dev/null || date -u -d '+60 days' +%F)

curl -s -X POST -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"from":"DXB","to":"LHR","fromDate":"'"$FROM_DATE"'"}' \
  "https://api.wego.com/v1/flights/searches"
```

Source: https://agents.wego.com/api/flights/create-flight-search/index.mdx
