Variables
List Agent Variables
List an environment’s variables for an agent.
GET
/
v2
/
agents
/
{agent_id}
/
environments
/
{env}
/
variables
List Agent Variables
curl --request GET \
--url https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"variable_key": "CRM_API_KEY",
"value": "{{SECRET.AGENT_8ffa3e15_b4fc_485d_b6cf_bded7a6ee070_PRODUCTION_43524d5f4150495f4b4559}}",
"updated_at": "2026-09-09T20:14:33.602Z"
},
{
"variable_key": "CRM_BASE_URL",
"value": "https://crm.example.com/api",
"updated_at": "2026-09-09T20:13:58.117Z"
},
{
"variable_key": "OFFICE_HOURS",
"value": {
"open": "08:00",
"close": "17:30",
"timezone": "America/Chicago"
},
"updated_at": "2026-09-10T11:47:05.940Z"
}
],
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_ENV",
"message": "env must be one of: dev, staging, production"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}
Overview
Returns the variables stored for one of the agent’s environments, sorted by key. Agent configuration refers to a variable as{{env.KEY}}, and the environment a call runs as decides which set is substituted: production for normal calls, staging when calling the staging pin, and dev for dev, branch, or specific-version calls. Set values with Set Agent Variable.
Headers
Path Parameters
Response
Array of variable objects ordered by
variable_key ascending. Empty when the environment has no variables.Show variable object
Show variable object
{
"data": [
{
"variable_key": "CRM_API_KEY",
"value": "{{SECRET.AGENT_8ffa3e15_b4fc_485d_b6cf_bded7a6ee070_PRODUCTION_43524d5f4150495f4b4559}}",
"updated_at": "2026-09-09T20:14:33.602Z"
},
{
"variable_key": "CRM_BASE_URL",
"value": "https://crm.example.com/api",
"updated_at": "2026-09-09T20:13:58.117Z"
},
{
"variable_key": "OFFICE_HOURS",
"value": {
"open": "08:00",
"close": "17:30",
"timezone": "America/Chicago"
},
"updated_at": "2026-09-10T11:47:05.940Z"
}
],
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_ENV",
"message": "env must be one of: dev, staging, production"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
List Agent Variables
curl --request GET \
--url https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/environments/{env}/variables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"variable_key": "CRM_API_KEY",
"value": "{{SECRET.AGENT_8ffa3e15_b4fc_485d_b6cf_bded7a6ee070_PRODUCTION_43524d5f4150495f4b4559}}",
"updated_at": "2026-09-09T20:14:33.602Z"
},
{
"variable_key": "CRM_BASE_URL",
"value": "https://crm.example.com/api",
"updated_at": "2026-09-09T20:13:58.117Z"
},
{
"variable_key": "OFFICE_HOURS",
"value": {
"open": "08:00",
"close": "17:30",
"timezone": "America/Chicago"
},
"updated_at": "2026-09-10T11:47:05.940Z"
}
],
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_ENV",
"message": "env must be one of: dev, staging, production"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}