---
title: "Discard the draft (delete it and end its live test instances)"
method: DELETE
path: "/v1/organizations/{organization_id}/templates/{slug}/draft"
tags: ["Template drafts"]
---

# Discard the draft (delete it and end its live test instances)

`DELETE /v1/organizations/{organization_id}/templates/{slug}/draft`

## Request

- Base URL: `https://api.shardflux.dev`
- URL: `https://api.shardflux.dev/v1/organizations/{organization_id}/templates/{slug}/draft`
- Auth: HTTP bearer

Deletes the draft (operation `delete`, input.reason draft_discarded) and ends each live test instance (ended_reason draft_discarded). 202 with the draft’s delete operation. Supports Idempotency-Key.

## Path parameters

- `organization_id` string, uuid, required
- `slug` string, required

## Response `202`

Default Response

- object
  - `operation` Operation, required
    - `id` string, uuid, required: UUIDv7, lowercase canonical form.
    - `kind` 'open' | 'suspend' | 'resume' | 'fork' | 'snapshot' | 'restore' | 'delete' | 'move' | 'resize' | 'upgrade' | 'volume_create' | 'volume_attach' | 'volume_detach' | 'volume_delete' | 'reset' | 'layer_snapshot', required
    - `state` 'queued' | 'capacity_pending' | 'running' | 'succeeded' | 'failed' | 'canceled', required
    - `workspace_id` string, uuid, nullable, required: UUIDv7, lowercase canonical form.
    - `volume_id` string, uuid, nullable: UUIDv7, lowercase canonical form.
    - `created_at` string, date-time, required: RFC 3339 UTC timestamp with Z.
    - `updated_at` string, date-time, required: RFC 3339 UTC timestamp with Z.
    - `started_at` string, date-time, nullable: RFC 3339 UTC timestamp with Z.
    - `completed_at` string, date-time, nullable: RFC 3339 UTC timestamp with Z.
    - `state_reason` string, nullable: Closed reason code while waiting (e.g. capacity_pending: no_ready_host).
    - `input` object
    - `error` object
    - `result` object
      - `durable` boolean: suspend and fork: whether the capture is in durable storage. false while `durability.state` is pending (the suspend completed on its host) or lost; true once it committed. Absent on other kinds.
      - `suspend_path` string: suspend: `local_commit` when the suspend completed on its host and the durable copy followed in the background.
      - `durability` object
        - `state` 'pending' | 'durable' | 'lost', required: pending: sealed on its host, the durable copy is being written; durable: the copy committed; lost: the copy could not be made and the previous recovery point stays current.
        - `checkpoint_id` string: The checkpoint being made durable.
        - `generation_id` string: Its generation on the host.
        - `local_commit_at` string: RFC 3339: when the suspend (or fork) completed on its host.
        - `durable_by` string: RFC 3339: when the durable copy is expected to have committed (local_commit_at + the deadline).
        - `durable_at` string: RFC 3339 (state durable): when the durable copy committed.
        - `local_commit_to_durable_ms` number: State durable: local_commit_at to durable_at, in milliseconds.
        - `overdue_at` string: RFC 3339: set once durable_by passed while the copy was still pending; it keeps retrying.
        - `reason` string: State lost: why, e.g. host_lost.
        - `code` string: State lost: the error code of the failed copy.
        - `recovery_point_checkpoint_id` string, nullable: State lost: the durable checkpoint that stays the recovery point (null when there is none).
      - `lost_suspend` object
        - `checkpoint_id` string, required: The suspend checkpoint whose durable copy was lost.
        - `generation_id` string: Its generation on the host.
        - `reason` string: Why it was lost, e.g. host_lost.
        - `suspended_at` string: RFC 3339: when that suspend captured the workspace.
        - `restored_checkpoint_id` string: The earlier durable checkpoint this resume restored.
        - `state_as_of` string: RFC 3339: when the restored checkpoint committed; the workspace state is as of then.
      - `host_lost` object
        - `detected_at` string, required: RFC 3339: when the host failure was detected; the workspace was suspended then.
        - `restored_from` 'disk' | 'checkpoint': resume and open: disk when the workspace booted from its disk (files kept, processes and memory not); checkpoint when it was restored from its newest checkpoint (see state_as_of). Absent on a suspend.
        - `restored_checkpoint_id` string: restored_from checkpoint: the checkpoint this resume restored.
        - `state_as_of` string: restored_from checkpoint, RFC 3339: when that checkpoint committed; the workspace state is as of then.
    - `progress` SuspendProgress
      - `operation_id` string, uuid, required: UUIDv7, lowercase canonical form.
      - `state` 'queued' | 'capacity_pending' | 'running' | 'succeeded' | 'failed' | 'canceled', required
      - `workspace_state` 'creating' | 'starting' | 'running' | 'suspending' | 'suspended' | 'resuming' | 'forking' | 'stopping' | 'failed' | 'deleting' | 'deleted', required
      - `phase` string, required: Actual snapshot preparation/capture phase, or an explicitly unavailable control status.
      - `cancelable` boolean, required: True only while the host can acknowledge cancellation before its capture cut.
      - `supported` boolean, required
      - `safe_action` 'wait_for_terminal' | 'resume' | 'retry_tools' | 'inspect_failure', required
      - `phase_started_at` string, date-time: RFC 3339 UTC timestamp with Z.
      - `deadline_at` string, date-time: RFC 3339 UTC timestamp with Z.
      - `accepted` boolean

## Other responses

- `4XX`: Default Response
- `5XX`: Default Response

---

[API](https://skmtc.dev/shardflux/apis/shardflux-api.md) · [All operations](https://skmtc.dev/shardflux/apis/shardflux-api/llms.txt) · [OpenAPI document](https://skmtc.dev/shardflux/apis/shardflux-api/revisions/ea685f7b39c4?raw)
