> ## 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.

Read only
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 `data.data.keys` as `["city", "name", "product"]`: `phone_number` is excluded because it is reserved as the dial target rather than a personalization variable. The reserved `tags`, `notes` and `agent_transfer_destinations` columns are excluded too.

## 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 are the union of the dynamic variables carried by the leads currently enrolled in the workflow, sorted alphabetically. Removed leads do not contribute, and on a draft workflow each upload replaces every lead, so only the latest file counts. If a column was present in one upload and absent from another, its key still appears while any lead carries it; treat the list as "available", not "always populated per lead".

## Path parameters

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

## Errors

* An unknown workflow ID is not an error: the response is `200` with an empty `keys` list. The same empty list is returned whenever the keys cannot be read, so this endpoint does not return `500`.
* `401 Unauthorized` is returned when the API key is missing or invalid.

## Related endpoints

* [List Workflow Leads](https://dialnexa.com/docs/api-reference/v1/workflow-leads/list.md): view enrolled leads.
* [Upload Workflow Leads](https://dialnexa.com/docs/api-reference/v1/workflow-leads/add.md): upload a CSV or Excel file with dynamic variable columns.
* [Dynamic variables](https://dialnexa.com/docs/agents/dynamic-variables.md): 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 `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/workflows/{workflowId}/leads/variable-keys:
    get:
      tags:
        - Workflow Leads
      summary: Get Workflow Lead Variables
      description: >-
        Returns the sorted dynamic variable keys carried by the leads currently
        enrolled in one workflow. An unknown workflow ID returns an empty list.
      operationId: listWorkflowLeadVariableKeys
      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:
                    success: true
                    error: false
                    statusCode: 200
                    message: Success
                    data:
                      statusCode: 200
                      message: Variable keys fetched successfully
                      data:
                        keys:
                          - customer_name
                          - loan_amount
                          - product
                    timestamp: '2026-09-07T06:00:00.000Z'
              schema:
                type: object
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - data
                  - timestamp
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  error:
                    type: boolean
                    enum:
                      - false
                  statusCode:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Success
                  data:
                    type: object
                    properties:
                      statusCode:
                        type: number
                        example: 200
                      message:
                        type: string
                        example: Variable keys fetched successfully
                      data:
                        type: object
                        properties:
                          keys:
                            type: array
                            items:
                              type: string
                            description: Sorted, de-duplicated keys.
                  timestamp:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized - missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    statusCode: 401
                    error: true
                    success: false
                    data: []
                    message: Invalid API key
                    errors: []
      security:
        - bearer: []
components:
  schemas:
    ErrorResponse:
      type: object
      description: Error body on endpoints without response filtering.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.