Skip to main content
POST
/
v1
/
workflows
/
{workflow_id}
/
discard-draft
from retab import Retab

client = Retab()

workflow = client.workflows.discard_draft("wf_abc123xyz")

print(workflow.published.version_id)
{
  "id": "wf_abc123xyz",
  "name": "Invoice Processing",
  "description": "Extract invoice fields and route for review",
  "published": {
    "version_id": "ver_8zJfV7T9qK2mP4xN6bR1cD3eF5gH7iJ9",
    "published_at": "2026-05-01T14:30:00Z"
  },
  "created_at": "2026-04-30T17:00:00Z",
  "updated_at": "2026-05-01T14:30:00Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.retab.com/llms.txt

Use this file to discover all available pages before exploring further.

Discard all unpublished draft changes and restore the workflow to its last published version. The blocks and edges are recreated from the published snapshot, so the draft you see in the editor matches what new runs execute. This is the inverse of Publish Workflow: publish promotes the draft to a new version; discard throws the draft away and rolls back to the current published version. The workflow must already be published — there is no published state to restore to otherwise.
from retab import Retab

client = Retab()

workflow = client.workflows.discard_draft("wf_abc123xyz")

print(workflow.published.version_id)
{
  "id": "wf_abc123xyz",
  "name": "Invoice Processing",
  "description": "Extract invoice fields and route for review",
  "published": {
    "version_id": "ver_8zJfV7T9qK2mP4xN6bR1cD3eF5gH7iJ9",
    "published_at": "2026-05-01T14:30:00Z"
  },
  "created_at": "2026-04-30T17:00:00Z",
  "updated_at": "2026-05-01T14:30:00Z"
}

Authorizations

Api-Key
string
header
required

Path Parameters

workflow_id
string
required

Response

Successful Response

A workflow and its current configuration.

id
string
required

Unique ID for this workflow

created_at
string<date-time>
required
updated_at
string<date-time>
required
name
string
default:Untitled Workflow

The name of the workflow

description
string
default:""

Description of the workflow

published
WorkflowPublished · object

Published workflow metadata when a published version exists