# MD_LIST_FLIGHT_VERSIONS
> List the version history of a Flight.
Returns every `FlightVersion` for a single [Flight](/concepts/flights), newest first. Use this to browse the history of source, requirements, config, token, and secrets changes.

## Syntax

```sql
SELECT * FROM MD_LIST_FLIGHT_VERSIONS(
    flight_id := '<flight_id>',
    "LIMIT" := <n>,
    "OFFSET" := <n>
);
```

## Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `flight_id` | `UUID` | Yes | | Identifier of the Flight. |
| `LIMIT` | `BIGINT` | No | `20` | Maximum number of versions to return. |
| `OFFSET` | `BIGINT` | No | `0` | Skip this many versions before returning. |

`LIMIT` and `OFFSET` are SQL keywords and must be quoted when used as named arguments.

## Return columns

| Column | Type | Description |
|---|---|---|
| `flight_version` | `INTEGER` | Version number, newest first. |
| `source_code` | `VARCHAR` | Python source for this version. |
| `requirements_txt` | `VARCHAR` | `requirements.txt` contents for this version. |
| `access_token_name` | `VARCHAR` | Access token label for this version. |
| `flight_secret_names` | `LIST(VARCHAR)` | Secret names list for this version. |
| `config` | `MAP(VARCHAR, VARCHAR)` | Config map for this version. |
| `created_at` | `TIMESTAMP WITH TIME ZONE` | When this version was created. |

## Examples

Get the full version history:

```sql
SELECT flight_version, source_code, requirements_txt
FROM MD_LIST_FLIGHT_VERSIONS(flight_id := '<flight_id>');
```

Just the latest version:

```sql
SELECT flight_version, source_code
FROM MD_LIST_FLIGHT_VERSIONS(flight_id := '<flight_id>', "LIMIT" := 1);
```

Skip the latest, get the rest:

```sql
SELECT flight_version, source_code
FROM MD_LIST_FLIGHT_VERSIONS(flight_id := '<flight_id>', "OFFSET" := 1);
```

## Related

- [`MD_GET_FLIGHT_VERSION`](../md-get-flight-version) — Fetch a single version by number.
- [`MD_LIST_FLIGHT_RUNS`](../md-list-flight-runs) — Each run row includes the `flight_version` it used.
- [`list_flight_versions` MCP tool](/sql-reference/mcp/) — AI-agent equivalent.


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmotherduck-sql-reference%2Fflights%2Fmd-list-flight-versions%2F&page_title=MD_LIST_FLIGHT_VERSIONS&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
