> ## Documentation Index
> Fetch the complete documentation index at: https://dialnexa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Workflow Lead Variables

> List dynamic variable keys found in workflow leads.

<span data-api-safety-label="read-only"><Badge color="gray" size="sm" shape="pill">Read only</Badge></span>

<Info>
  **Recommended.** This endpoint is part of the public `/v1` API reference and is the supported path for new integrations. See the [migration guide](/docs/api-reference/v1/migrating-to-v1) for versioning guidance.
</Info>

Returns the list of dynamic variable keys derived from the column headers of the lead files uploaded to this workflow. These keys are what you can reference inside an agent's prompt using the `{{variable_name}}` template syntax. For example, if a lead file contained the columns `phone_number`, `name`, `city`, and `product`, this endpoint returns the variable list `["name", "city", "product"]`: `phone_number` is excluded because it is reserved as the dial target rather than a personalization variable.

## When to use this

* **Prompt editors**: populate an autocomplete or "available variables" panel so the prompt author can only reference variables that actually exist on this workflow's leads.
* **Validation pipelines**: verify a prompt template before publishing an agent change. Reject the deploy if it references a `{{variable_name}}` that does not appear in this list.
* **Workflow audits**: confirm a newly uploaded lead file produces the columns the prompt expects, especially after editing the upload schema.

The keys returned reflect the union of all lead-file column headers ever uploaded to the workflow. If a column disappeared from later uploads, its key may still appear here; treat the list as "available", not "always populated per lead".

## Path parameters

| Parameter    | Description                                      |
| ------------ | ------------------------------------------------ |
| `workflowId` | The workflow ID, for example `wfl_m3v7zb9rk2px`. |

## Errors

* `404 Not Found` is returned when the workflow does not exist.
* `403 Forbidden` is returned when the API key cannot read workflows on this workspace.

## Related endpoints

* [List Workflow Leads](/docs/api-reference/v1/workflow-leads/list): view enrolled leads.
* [Upload Workflow Leads](/docs/api-reference/v1/workflow-leads/add): upload a CSV or Excel file with dynamic variable columns.
* [Dynamic variables](/docs/agents/dynamic-variables): guidance on referencing variables inside prompts.


## OpenAPI

````yaml GET /v1/workflows/{workflowId}/leads/variable-keys
openapi: 3.0.0
info:
  title: DialNexa API
  description: >-
    Public REST API for the DialNexa voice AI platform. Versioned endpoints are
    under /v1; unversioned endpoints are legacy and deprecated.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: API Keys
  - name: Agent Functions
  - name: Agents V1
  - name: Agents2
  - name: Batch Calls
  - name: Batch Calls V1
  - name: Call Logs
  - name: Calls
  - name: Calls V1
  - name: Campaign Leads
  - name: Campaigns
  - name: External Webhooks
  - name: Knowledge Base
  - name: Knowledge Base V1
  - name: LLMs
  - name: LLMs V1
  - name: Languages
  - name: Languages V1
  - name: Organization Phone Numbers
  - name: Organization Phone Numbers V1
  - name: Phone Number Pricing
  - name: Phone Number Pricing V1
  - name: Transcribers
  - name: Transcribers V1
  - name: User Webhooks
  - name: User Webhooks V1
  - name: V1
  - name: Voices
  - name: Voices V1
  - name: Webcall
  - name: Workflow Leads
  - name: Workflow Leads V1
  - name: Workflows
  - name: Workflows V1
paths:
  /v1/workflows/{workflowId}/leads/variable-keys:
    get:
      tags:
        - Workflow Leads V1
        - V1
      summary: Get Workflow Lead Variables
      description: Returns dynamic variable keys discovered across leads in one workflow.
      operationId: WorkflowLeadsV1Controller_getVariableKeys
      parameters:
        - name: workflowId
          required: true
          in: path
          description: Workflow ID
          schema:
            type: string
            example: workflow_abc123
      responses:
        '200':
          description: Variable keys returned successfully.
          content:
            application/json:
              examples:
                success:
                  summary: Successful response
                  value:
                    statusCode: 200
                    message: Variable keys fetched successfully
                    data:
                      keys:
                        - customer_name
                        - loan_amount
                        - product
        '401':
          description: Unauthorized - missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    statusCode: 401
                    message: API key is missing or invalid
                    error: Unauthorized
        '403':
          description: Forbidden - workflow does not belong to your organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 403 Forbidden
                  value:
                    statusCode: 403
                    message: You do not have permission to access this workflow
                    error: Forbidden
        '404':
          description: Workflow not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 404 Not Found
                  value:
                    statusCode: 404
                    message: Workflow not found
                    error: Not Found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 500 Internal Server Error
                  value:
                    statusCode: 500
                    message: Internal server error
                    error: Internal Server Error
      security:
        - bearer: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          example: phone_number must be a valid E.164 phone number
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
        - error
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````