# Get Workflow Definition

`GET /api/workflows/{id}`

## Description
Get a workflow's record together with its current draft graph (blocks, edges, loops, parallels) and variables. For deployment metadata only, use Get Workflow Status. For a summary that includes limits, use the /api/v1/workflows/{id} endpoint.

## Parameters

- **id** (path) (required) — `string`: The unique identifier of the workflow.

## Responses

### 200 — The workflow record and its draft graph.

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "additionalProperties": true,
      "description": "The workflow record (id, name, description, workspaceId, isDeployed, deployedAt, and other columns) plus the fields below.",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "workspaceId": {
          "type": "string"
        },
        "isDeployed": {
          "type": "boolean"
        },
        "deployedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "state": {
          "type": "object",
          "description": "The current draft graph.",
          "properties": {
            "blocks": {
              "type": "object",
              "additionalProperties": true,
              "description": "Blocks keyed by block ID."
            },
            "edges": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "loops": {
              "type": "object",
              "additionalProperties": true
            },
            "parallels": {
              "type": "object",
              "additionalProperties": true
            },
            "isDeployed": {
              "type": "boolean"
            },
            "deployedAt": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "lastSaved": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds of this read."
            },
            "metadata": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "variables": {
          "type": "object",
          "additionalProperties": true,
          "description": "Workflow variables keyed by variable ID."
        }
      }
    }
  }
}
```

### 401 — Invalid or missing API key. Ensure the X-API-Key header is set with a valid key.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 403 — The key is not authorized for this workflow's workspace, or the caller cannot read the workflow.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
```

### 404 — The requested resource was not found. Verify the ID is correct and belongs to your workspace.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```
