draft

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

Changed on
post/w/{workspace}/drafts/update/{kind}/{path}

Request

  • Base URL: /api (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/w/{workspace}/drafts/update/{kind}/{path}
  • Auth: one of:
    • HTTP bearer
    • API key in cookie token

Path parameters

workspacestring 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.

pathstring required

Request body

valueunknown
last_syncstring date-time

Server timestamp of the client's last known sync for this draft. Omit on first save.

forceboolean

Skip the conflict check and overwrite the server copy.

legacyboolean

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_atstring 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

save result

status'saved' | 'conflict' required
current_timestampstring date-time required
pathstring

saved only, upsert or delete: where the write landed. Differs from the URL path when the item had moved away from it; the editor follows it there. Absent when a delete found nothing to remove and the caller cannot read the path it moved to.

Changes