---
title: "upsert (or clear) the current user's draft at a path"
method: POST
path: "/w/{workspace}/drafts/update/{kind}/{path}"
tags: ["draft"]
---

# upsert (or clear) the current user's draft at a path

`POST /w/{workspace}/drafts/update/{kind}/{path}`

## Path parameters

- `workspace` string, required
- `kind` 'script' | 'flow' | 'app' | 'raw_app' | 'resource' | 'variable' | 'trigger_schedule' | 'trigger_webhook' | 'trigger_default_email' | 'trigger_email' | 'trigger_http' | 'trigger_websocket' | 'trigger_postgres' | 'trigger_kafka' | 'trigger_nats' | 'trigger_mqtt' | 'trigger_amqp' | 'trigger_sqs' | 'trigger_gcp' | 'trigger_azure' | 'trigger_poll' | 'trigger_cli' | 'trigger_nextcloud' | 'trigger_google' | 'trigger_github' | 'data_pipeline', required — Closed set of item kinds a user can autosave as a draft. Mirrors the Postgres `DRAFT_KIND` enum and the backend `UserDraftItemKind`.
- `path` string, required

## Request body

- object
  - `value` unknown
  - `last_sync` string, date-time — Server timestamp of the client's last known sync for this draft. Omit on first save.
  - `force` boolean — Skip the conflict check and overwrite the server copy.
  - `legacy` boolean — Delete-only. Target the legacy workspace-level row (email NULL) instead of the current user's row. Used to discard a legacy draft from the review page.
  - `created_at` string, date-time — Upsert-only override for the stored creation timestamp. Normal saves omit it (stamped server-side); the localStorage→DB migration passes the draft's original write time so migrated drafts keep their age.

## Response `200`

save result

- object
  - `status` 'saved' | 'conflict', required
  - `current_timestamp` string, date-time, required

---

[API](https://skmtc.net/windmill/apis/windmill-api.md) · [All operations](https://skmtc.net/windmill/apis/windmill-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/windmill/windmill-api/revisions/964225251155/schema)
