> ## Documentation Index
> Fetch the complete documentation index at: https://cobalt-55-abhishek.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Workflow Draft

> Get the editable draft of a workflow.

Return the editable draft of a workflow. If no draft exists yet, the published version is cloned into a new draft (along with any associated AI agent chats), and that draft is returned.

<Note>
  This authenticates as a linked account, so it operates on that account's **private** workflows.
</Note>

## Authentication

This endpoint is scoped to a linked account, so it accepts **either** authentication method.

**Option 1 — API key**

<ParamField header="x-api-key" type="string">Your Refold API key.</ParamField>
<ParamField header="linked_account_id" type="string">The linked account that owns the workflow.</ParamField>

**Option 2 — Session token**

<ParamField header="Authorization" type="string">Session token. **Format:** `Bearer YOUR_SESSION_TOKEN`</ParamField>

## Path Parameters

<ParamField path="workflow_id" type="string" required>
  The workflow ID. This draft ID is what you pass to [Publish Workflow](/v3/api-reference/workflows/publish-workflow) — publishing then returns a separate published ID.
</ParamField>

## Response

<Tabs>
  <Tab title="200 OK">
    Returns the draft workflow, including `nodes`, `edges`, `data_slots`, and the link to its `associated_workflow`.
  </Tab>

  <Tab title="404 Not Found">
    <ResponseField name="status_code" type="integer">HTTP status code.</ResponseField>
    <ResponseField name="http_error_type" type="string">Error category.</ResponseField>
    <ResponseField name="error_code" type="string">Internal error code.</ResponseField>
    <ResponseField name="message" type="string">Human-readable error description.</ResponseField>
  </Tab>
</Tabs>

<ResponseExample>
  ```json 200 theme={null}
  {
    "_id": "69fdfe21957a1b5597aa04c3",
    "associated_workflow": "69fdfe21957a1b5597aa04bd",
    "name": "Daily Sync",
    "enable_schema_validation": false,
    "nodes": [
      { "id": "1", "type": "start" }
    ],
    "edges": [],
    "data_slots": [],
    "createdAt": "2026-05-08T15:15:45.616Z",
    "updatedAt": "2026-05-08T15:15:45.616Z"
  }
  ```

  ```json 404 theme={null}
  {
    "status_code": 404,
    "http_error_type": "NOT_FOUND",
    "error_code": "SERVER_ERROR",
    "message": "Workflow not found"
  }
  ```
</ResponseExample>

<RequestExample>
  ```bash cURL (API key) theme={null}
  curl -X GET "https://app.refold.ai/api/v2/public/workflow/{workflow_id}/edit" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "linked_account_id: YOUR_LINKED_ACCOUNT_ID"
  ```

  ```bash cURL (session token) theme={null}
  curl -X GET "https://app.refold.ai/api/v2/public/workflow/{workflow_id}/edit" \
    -H "Authorization: Bearer YOUR_SESSION_TOKEN"
  ```
</RequestExample>
