# update_flight
> Update a Flight's source, requirements, config, token, secrets, chart, name, or schedule.
Update a [Flight](/concepts/compute/flights). Any subset of `name`, `source_code`, `requirements_txt`, `schedule_cron`, `config`, `access_token_name`, `flight_secret_names`, `max_runtime_sec`, `instance_type`, or `metadata` may be provided.

Updates to `source_code`, `requirements_txt`, `config`, `flight_secret_names`, `access_token_name`, `max_runtime_sec`, `instance_type`, or the chart in `metadata` produce a new `FlightVersion`. Updates to `name` or `schedule_cron` are metadata-only. Sending the chart the Flight already has does not create a version.

You are responsible for the code you run and the packages it installs. Flights does not scan customer code or dependencies. Avoid untrusted packages, pin dependency versions, and treat dependency installs as a supply-chain risk.

## Description

`update_flight` is a PATCH operation: omitted fields are left unchanged. To clear the schedule, pass `schedule_cron` as an empty string; omitting it leaves the schedule unchanged.

`config` and `flight_secret_names` are **full replacements** — to change one entry, send the full map or list with the change applied.

The SQL equivalent is [`MD_UPDATE_FLIGHT`](/sql-reference/motherduck-sql-reference/flights/md-update-flight).

## Input parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string (UUID) | Yes | The Flight UUID. |
| `name` | string | No | Updated Flight name. Metadata-only. |
| `schedule_cron` | string | No | Updated 5-field cron expression (UTC). Pass `""` to clear the schedule. Metadata-only. |
| `source_code` | string | No | Updated Python entrypoint source. Bumps the version. |
| `requirements_txt` | string | No | Updated `requirements.txt` contents. Bumps the version. |
| `config` | object | No | Replacement config map (full replace). Bumps the version. |
| `access_token_name` | string | No | Updated MotherDuck access token label. Bumps the version. |
| `flight_secret_names` | string[] | No | Replacement list of secret names (full replace). Bumps the version. |
| `metadata` | object | No | Flight control metadata. The only supported key is `chart`: the run chart for the [Flight Explainer](/key-tasks/flights/observability/explain-flight-runs), as raw Mermaid. Limited to 64 KiB as UTF-8. Pass `""` to clear the chart. Bumps the version when the chart changes. |
| `max_runtime_sec` | integer | No | Per-run timeout in seconds. `0` means no timeout. A value above your plan's cap is rejected. Bumps the version. |
| `instance_type` | string | No | [Instance size](/about-motherduck/billing/flight-sizes/): `F4`, `F16`, or `F32`. A size above your plan's cap is rejected. Bumps the version. |

## Output schema

```json
{
  "success": boolean,
  "flight": {
    "id": string,
    "name": string,
    "schedule_cron": string|null,
    "current_version": number
  },
  "error": string
}
```

## Example usage

Rename only:

```json
{ "id": "80000000-...", "name": "analytics_hourly_sync" }
```

Update source (bumps version):

```json
{
  "id": "80000000-...",
  "source_code": "def main():\n    print('v2')\n\nif __name__ == \"__main__\":\n    main()\n"
}
```

Clear the schedule:

```json
{ "id": "80000000-...", "schedule_cron": "" }
```

## Related

- [`edit_flight_source`](../edit-flight-source) — Edit source without resending the whole file.
- [`get_flight`](../get-flight) — Read current state before editing.
- [`MD_UPDATE_FLIGHT`](/sql-reference/motherduck-sql-reference/flights/md-update-flight) — SQL 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%2Fmcp%2Fflights%2Fupdate-flight%2F&page_title=update_flight&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.
