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

# Function Variables

API operations for function variables. Browse the routes below for parameters, request examples, and responses.

API version: Selected per operation

## List variables

Returns every function variable in its function. A function variable is an input or output a function declares. The call takes no paging parameters, so one request yields the whole set.

### Endpoint

```http
GET /v1/stable/function-variable
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

#### `functionID`

Required · string

The ID of the function whose variables to list.

```json
{
  "type": "string",
  "description": "The ID of the function whose variables to list."
}
```

### Responses

#### 200

Returns every variable declared on a single function, selected by the functionID query parameter, each marked as an input or an output and named as the function code references it.

Schema:

```json
{
  "$ref": "#/components/schemas/StableFunctionVariableListResponse"
}
```

Example:

```json
{
  "variables": [
    {
      "id": "<string>",
      "name": "<string>",
      "type": "input",
      "createdAt": "2026-09-10T00:00:00.000Z",
      "updatedAt": "2026-09-10T00:00:00.000Z",
      "functionID": "<string>",
      "description": "<string>"
    }
  ]
}
```

### Request examples

#### cURL

```bash
curl --request GET \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>&functionID=<functionID>' \
  --header 'Authorization: Bearer <token>'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>&functionID=<functionID>', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <token>',
  },
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.get(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>&functionID=<functionID>',
    headers={'Authorization': 'Bearer <token>'},
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable list --project-id <projectID> --environment-alias <environmentAlias> --function-id <functionID>
```


## Create variable

Adds a function variable to its function, an input or output a function declares. The response carries the ID that later calls address it by.

### Endpoint

```http
POST /v1/stable/function-variable
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

### Request body

Required

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/StableFunctionVariableCreateRequest"
      }
    }
  }
}
```

### Responses

#### 201

Creates the function variable and returns it, including its new ID, whether it is an input or an output, and the functionID of the function that declares it.

Schema:

```json
{
  "$ref": "#/components/schemas/StableFunctionVariableResponse"
}
```

Example:

```json
{
  "variable": {
    "id": "<string>",
    "name": "<string>",
    "type": "input",
    "createdAt": "2026-09-10T00:00:00.000Z",
    "updatedAt": "2026-09-10T00:00:00.000Z",
    "functionID": "<string>",
    "description": "<string>"
  }
}
```

### Request examples

#### cURL

```bash
curl --request POST \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "type": "input",
  "functionID": "<string>",
  "description": "<string>"
}'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "<string>",
    "type": "input",
    "functionID": "<string>",
    "description": "<string>"
  }),
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.post(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable?projectID=<projectID>&environmentAlias=<environmentAlias>',
    headers={'Authorization': 'Bearer <token>'},
    json={
      "name": "<string>",
      "type": "input",
      "functionID": "<string>",
      "description": "<string>"
    },
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable create --project-id <projectID> --environment-alias <environmentAlias> <<'JSON'
{
  "name": "<string>",
  "type": "input",
  "functionID": "<string>",
  "description": "<string>"
}
JSON
```


## Create many variables

Adds several function variables to its function in one request, each taking the fields the single-create call takes. The response carries the created function variables in the same shape the list call returns.

### Endpoint

```http
POST /v1/stable/function-variable/batch
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

### Request body

Required

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/StableFunctionVariableCreateManyRequest"
      }
    }
  }
}
```

### Responses

#### 201

Returns the newly created function variables, each with its own ID, its input or output kind, and the functionID of the function it was attached to.

Schema:

```json
{
  "$ref": "#/components/schemas/StableFunctionVariableListResponse"
}
```

Example:

```json
{
  "variables": [
    {
      "id": "<string>",
      "name": "<string>",
      "type": "input",
      "createdAt": "2026-09-10T00:00:00.000Z",
      "updatedAt": "2026-09-10T00:00:00.000Z",
      "functionID": "<string>",
      "description": "<string>"
    }
  ]
}
```

### Request examples

#### cURL

```bash
curl --request POST \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable/batch?projectID=<projectID>&environmentAlias=<environmentAlias>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "functionID": "<string>",
  "variables": [
    {
      "name": "<string>",
      "type": "input",
      "description": "<string>"
    }
  ]
}'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable/batch?projectID=<projectID>&environmentAlias=<environmentAlias>', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "functionID": "<string>",
    "variables": [
      {
        "name": "<string>",
        "type": "input",
        "description": "<string>"
      }
    ]
  }),
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.post(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable/batch?projectID=<projectID>&environmentAlias=<environmentAlias>',
    headers={'Authorization': 'Bearer <token>'},
    json={
      "functionID": "<string>",
      "variables": [
        {
          "name": "<string>",
          "type": "input",
          "description": "<string>"
        }
      ]
    },
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable create-many --project-id <projectID> --environment-alias <environmentAlias> <<'JSON'
{
  "functionID": "<string>",
  "variables": [
    {
      "name": "<string>",
      "type": "input",
      "description": "<string>"
    }
  ]
}
JSON
```


## Get variable

Returns a single function variable by ID, with the fields that define it. A function variable is an input or output a function declares.

### Endpoint

```http
GET /v1/stable/function-variable/{variableID}
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Path parameters

#### `variableID`

Required · string

The ID of the variable to operate on.

```json
{
  "type": "string"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

### Responses

#### 200

Returns a single function variable, with the name the function code uses to reference it, whether it is an input or an output, and the ID of the function that declares it.

Schema:

```json
{
  "$ref": "#/components/schemas/StableFunctionVariableResponse"
}
```

Example:

```json
{
  "variable": {
    "id": "<string>",
    "name": "<string>",
    "type": "input",
    "createdAt": "2026-09-10T00:00:00.000Z",
    "updatedAt": "2026-09-10T00:00:00.000Z",
    "functionID": "<string>",
    "description": "<string>"
  }
}
```

### Request examples

#### cURL

```bash
curl --request GET \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>' \
  --header 'Authorization: Bearer <token>'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <token>',
  },
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.get(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>',
    headers={'Authorization': 'Bearer <token>'},
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable get --variable-id <variableID> --project-id <projectID> --environment-alias <environmentAlias>
```


## Update variable

Changes an existing function variable in place. The response carries only a confirmation message, so refetch the function variable to read its new values.

### Endpoint

```http
PATCH /v1/stable/function-variable/{variableID}
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Path parameters

#### `variableID`

Required · string

The ID of the variable to operate on.

```json
{
  "type": "string"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

### Request body

Required

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StableFunctionVariableUpdateRequest"
          }
        ]
      }
    }
  }
}
```

### Responses

#### 200

Confirms the function variable was updated. The body confirms the write rather than returning the variable, so fetch the variable again to check its name, description, and whether it is an input or an output.

Schema:

```json
{
  "$ref": "#/components/schemas/StableUpdateResponse"
}
```

Example:

```json
{
  "message": "<string>"
}
```

### Request examples

#### cURL

```bash
curl --request PATCH \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "description": "<string>"
}'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "<string>",
    "description": "<string>"
  }),
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.patch(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>',
    headers={'Authorization': 'Bearer <token>'},
    json={
      "name": "<string>",
      "description": "<string>"
    },
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable update --variable-id <variableID> --project-id <projectID> --environment-alias <environmentAlias> <<'JSON'
{
  "name": "<string>",
  "description": "<string>"
}
JSON
```


## Delete variable

Deletes a single function variable by ID. A function variable is an input or output a function declares. The response carries only a confirmation message, so refetch the function variables to see what is left.

### Endpoint

```http
DELETE /v1/stable/function-variable/{variableID}
```

Server: https://realtime-api.voiceflow.com

### Authentication

```json
[
  {
    "token": []
  }
]
```

`token`:

```json
{
  "scheme": "bearer",
  "bearerFormat": "JWT",
  "type": "http",
  "description": "Voiceflow bearer token"
}
```

### Path parameters

#### `variableID`

Required · string

The ID of the variable to operate on.

```json
{
  "type": "string"
}
```

### Query parameters

#### `projectID`

Required · string

The ID of the project to operate on.

```json
{
  "type": "string",
  "description": "The ID of the project to operate on."
}
```

#### `environmentAlias`

Required · string

The alias of the environment to operate on (e.g. `main`).

```json
{
  "type": "string",
  "description": "The alias of the environment to operate on (e.g. `main`)."
}
```

### Responses

#### 200

Confirms the function variable was deleted. A message is all that comes back, so refetch the function's variables to see which inputs and outputs its code can still reference.

Schema:

```json
{
  "$ref": "#/components/schemas/StableDeleteResponse"
}
```

Example:

```json
{
  "message": "<string>"
}
```

### Request examples

#### cURL

```bash
curl --request DELETE \
  --url 'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>' \
  --header 'Authorization: Bearer <token>'
```

#### JavaScript

```javascript
const response = await fetch('https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>', {
  method: 'DELETE',
  headers: {
    Authorization: 'Bearer <token>',
  },
});
const data = await response.json();
```

#### Python

```python
import requests

response = requests.delete(
    'https://realtime-api.voiceflow.com/v1/stable/function-variable/<variableID>?projectID=<projectID>&environmentAlias=<environmentAlias>',
    headers={'Authorization': 'Bearer <token>'},
)
data = response.json()
```

#### Voiceflow CLI

```bash
vf function variable delete --variable-id <variableID> --project-id <projectID> --environment-alias <environmentAlias>
```


## Schema definitions

### FunctionVariableKind

```json
{
  "type": "string",
  "enum": [
    "input",
    "output"
  ],
  "x-enumNames": [
    "INPUT",
    "OUTPUT"
  ]
}
```

### StableDeleteResponse

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A human-readable message confirming the deletion."
    }
  },
  "required": [
    "message"
  ]
}
```

### StableFunctionVariable

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "description": "The name used to reference the variable in the function code."
    },
    "type": {
      "$ref": "#/components/schemas/FunctionVariableKind"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
    },
    "functionID": {
      "type": "string",
      "description": "The ID of the function this variable belongs to."
    },
    "description": {
      "nullable": true,
      "description": "A human-readable description of what the variable holds.",
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "type",
    "createdAt",
    "updatedAt",
    "functionID",
    "description"
  ]
}
```

### StableFunctionVariableCreateManyRequest

```json
{
  "type": "object",
  "properties": {
    "functionID": {
      "type": "string",
      "description": "The ID of the function to create the variables for."
    },
    "variables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name used to reference the variable in the function code."
          },
          "type": {
            "$ref": "#/components/schemas/FunctionVariableKind"
          },
          "description": {
            "nullable": true,
            "description": "A human-readable description of what the variable holds.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "type"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "functionID",
    "variables"
  ]
}
```

### StableFunctionVariableCreateRequest

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name used to reference the variable in the function code."
    },
    "type": {
      "$ref": "#/components/schemas/FunctionVariableKind"
    },
    "functionID": {
      "type": "string",
      "description": "The ID of the function this variable belongs to."
    },
    "description": {
      "nullable": true,
      "description": "A human-readable description of what the variable holds.",
      "type": "string"
    }
  },
  "required": [
    "name",
    "type",
    "functionID"
  ],
  "additionalProperties": false
}
```

### StableFunctionVariableListResponse

```json
{
  "type": "object",
  "properties": {
    "variables": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/StableFunctionVariable"
      }
    }
  },
  "required": [
    "variables"
  ]
}
```

### StableFunctionVariableResponse

```json
{
  "type": "object",
  "properties": {
    "variable": {
      "$ref": "#/components/schemas/StableFunctionVariable"
    }
  },
  "required": [
    "variable"
  ]
}
```

### StableFunctionVariableUpdateRequest

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name used to reference the variable in the function code."
    },
    "description": {
      "nullable": true,
      "description": "A human-readable description of what the variable holds.",
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### StableUpdateResponse

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A human-readable message confirming the update."
    }
  },
  "required": [
    "message"
  ]
}
```
