# Search flights (/api-reference/flights/search)

`GET https://api.voyagelabs.ai/v1/flights/search`

**Search a trip**

A search changes nothing, so GET is the main form. Trip fields decide which stored search answers; the other fields only shape the answer and never cause a supplier search.

Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer <key>`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `origin` | query | string | yes | 3-letter airport code. |
| `destination` | query | string | yes | 3-letter airport code, different from origin. |
| `depart_date` | query | string | yes | YYYY-MM-DD, not in the past, at most 11 months ahead. `depart` is accepted as an older name. |
| `return_date` | query | string | no | YYYY-MM-DD, on or after depart_date. Leave out for one-way. `return` is accepted as an older name. |
| `adults` | query | integer | no | Travellers aged 12 and over. |
| `children` | query | integer | no | Adults plus children at most 9. |
| `infants` | query | integer | no | At most one per adult. |
| `cabin` | query | `economy` \| `premium_economy` \| `business` \| `first` | no | The cabin to search. |
| `currency` | query | string | no | 3-letter code. |
| `max_stops` | query | integer | no | Keep itineraries with at most this many stops in each direction. |
| `airlines` | query | string | no | 2-character codes, comma separated. Keeps trips sold entirely by these airlines. |
| `sort` | query | `best` \| `price` \| `duration` | no | How to order results. |
| `limit` | query | integer | no | Results in this response. |
| `cursor` | query | string | no | The next_cursor of the previous page. |
| `detail` | query | `summary` \| `full` | no | How much of each result to send. |
| `fares` | query | integer | no | Fares per result. Only read when detail is full. `offers` is accepted as an older name. |
| `wait_ms` | query | integer | no | Answer with whatever has arrived by then, in milliseconds. Left out: 8000, so a new trip is answered when its search finishes or after 8 seconds with what has arrived (status partial); read the rest by search_id. Left out, an answer is never sent empty while the search runs: it waits on for the first itineraries, up to 30 seconds. |
| `max_age_s` | query | integer | no | The oldest price the caller accepts, in seconds. A stored answer older than this is searched again before the reply. |
| `stream` | query | `1` | no | Answer as server-sent events. The same as sending Accept: text/event-stream. |
| `debug` | query | `1` | no | Also say how the answer was produced, in meta.debug. For diagnosis; its shape may change within v1. |
| `response_mode` | query | `complete` \| `stream` \| `partial` | no | Delivery mode for partner searches: complete (default JSON — waits up to 30s for full results), stream (Server-Sent Events), or partial (fast return with search_id to poll). |

## Responses

- `200`: The search, complete or partial.
- `400`: `invalid_parameter`: A field is missing, malformed or out of range. `param` names it.
- `401`: `unauthenticated`: No key, or a key that is not known.
- `403`: `forbidden`: The key is switched off, may not use this route, or was used from outside its partner's listed networks, by the address our load balancer saw (never an address the caller wrote in X-Forwarded-For).
- `429`: `rate_limited`: This key is over its own limit.
- `500`: `internal_error`: A fault in the service. The detail is logged, never sent.
- `502`: `supplier_error`: The supplier failed.
- `503`: `search_capacity`: New searches are temporarily unavailable. Trips already in memory can still answer.
- `504`: `supplier_timeout`: The search did not finish in time: 45 seconds for the first supplier.