# MD_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_FLIGHT_VERSIONS(
    flight_id := '<flight_id>',
    "LIMIT" := <n>,
    "OFFSET" := <n>
);
```

## Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `flight_id` | `UUID` | Yes | Identifier of the Flight. |
| `LIMIT` | `BIGINT` | No | Maximum number of versions to return. |
| `OFFSET` | `BIGINT` | No | 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_FLIGHT_VERSIONS(flight_id := '<flight_id>');
```

Just the latest version:

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

Skip the latest, get the rest:

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

## Related

- [`MD_GET_FLIGHT_VERSION`](../md-get-flight-version) — Fetch a single version by number.
- [`MD_FLIGHT_RUNS`](../md-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 `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

```json
{
  "page_path": "/sql-reference/motherduck-sql-reference/flights/md-flight-versions/",
  "page_title": "MD_FLIGHT_VERSIONS",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

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