---
title: "Get workflow variables"
method: GET
path: "/workflows/{workflow_id}/variables"
tags: ["Workflows"]
---

# Get workflow variables

`GET /workflows/{workflow_id}/variables`

Retrieve all variables available in a workflow, including both fixed system variables and variables discovered from execution history.

Returns two categories of variables:
- **Fixed variables**: Built-in system and context variables always available (flow_id, started_at, channel, phone_number, etc.)
- **Discovered variables**: User-defined variables observed during workflow executions, with sample values and usage statistics

Use this endpoint to:
- Understand what variables are available for use in workflow steps
- Review variable types and sample values for debugging
- Build autocomplete for variable references in workflow editors

## Response `200`

Variables retrieved successfully

- WorkflowVariablesResponse — Workflow variables including fixed system variables and discovered user variables
  - `data` object, required
    - `fixed` object, required — Built-in variables always available in workflows
      - `system` object — System variables (flow_id, started_at, trigger_type, etc.)
      - `context` object — Context variables (channel, phone_number, contact, etc.)
    - `discovered` object, required — Variables discovered from workflow execution history
      - `system` DiscoveredVariable[]
        - `path` string, required — Full variable path (e.g., "vars.user_name", "system.flow_id")
        - `name` string, required — Variable name without namespace
        - `type` string, nullable, required — Inferred data type (string, number, boolean, object, array)
        - `sample_values` union[] — Sample values observed during executions (up to 5)
          - union
            - string
            - number
            - boolean
            - object
        - `usage_count` integer — Number of times this variable has been set
        - `last_seen_at` string, date-time, nullable — Last time this variable was recorded
        - `reference` string — Template reference syntax (e.g., "{{vars.user_name}}")
      - `context` DiscoveredVariable[]
        - `path` string, required — Full variable path (e.g., "vars.user_name", "system.flow_id")
        - `name` string, required — Variable name without namespace
        - `type` string, nullable, required — Inferred data type (string, number, boolean, object, array)
        - `sample_values` union[] — Sample values observed during executions (up to 5)
          - union
            - string
            - number
            - boolean
            - object
        - `usage_count` integer — Number of times this variable has been set
        - `last_seen_at` string, date-time, nullable — Last time this variable was recorded
        - `reference` string — Template reference syntax (e.g., "{{vars.user_name}}")
      - `vars` DiscoveredVariable[] — User-defined variables discovered during executions
        - `path` string, required — Full variable path (e.g., "vars.user_name", "system.flow_id")
        - `name` string, required — Variable name without namespace
        - `type` string, nullable, required — Inferred data type (string, number, boolean, object, array)
        - `sample_values` union[] — Sample values observed during executions (up to 5)
          - union
            - string
            - number
            - boolean
            - object
        - `usage_count` integer — Number of times this variable has been set
        - `last_seen_at` string, date-time, nullable — Last time this variable was recorded
        - `reference` string — Template reference syntax (e.g., "{{vars.user_name}}")

## Other responses

- `401` — Missing or invalid API key
- `404` — Resource not found

---

[API](https://skmtc.net/kapso/apis/kapso-platform-api.md) · [All operations](https://skmtc.net/kapso/apis/kapso-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kapso/kapso-platform-api/revisions/18ff5548a33f/schema)
