Get Environment Variables
Retrieve all environment variables for the Agent associated with the API key. Each environment variable is an Agent-level global value: all conversations share the same definition and value. It has no conversation-level override and is not changed by publishing or rolling back an Agent version.
Use the full name in supported variable references, for example {{env_brand}}. In the Loop Agent identity prompt editor, insert environment variables through the / variable selector.
This API returns environment variables only, excluding conversation properties and user properties. Each Agent can have up to 50 environment variables, counted separately from conversation properties.
Request Method
GET
Endpoint
https://api-${endpoint}.gptbots.ai/v1/env-variable/list
Authentication
Refer to API Overview for authentication instructions. Use the current Agent’s API key; no Agent ID, organization ID, or conversation_id is required.
Request
Example Request
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/env-variable/list' \
-H 'Authorization: Bearer ${API Key}'
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Obtain the key from the Agent’s API Key page. |
Request Parameters
None.
Response
Example Response
[
{
"name": "env_brand",
"type": "STRING",
"value": "GPTBots"
},
{
"name": "env_max_retry",
"type": "INTEGER",
"value": "3"
},
{
"name": "env_threshold",
"type": "NUMBER",
"value": "88.8888"
},
{
"name": "env_enabled",
"type": "BOOLEAN",
"value": "false"
},
{
"name": "env_launch_time",
"type": "DATETIME",
"value": "1767225600000"
}
]
Returns an empty array
[]when no environment variables are defined. The response is an array without an outerdatawrapper.
Successful Response
| Field | Type | Description |
|---|---|---|
| name | string | Full name, such as env_brand. Use this full name in references. |
| type | string | STRING, INTEGER, NUMBER, BOOLEAN, or DATETIME. |
| value | string | Global value, returned as a string when set. Treat null or an absent field as unset. BOOLEAN uses "true"/"false", and DATETIME uses an epoch-millisecond string. |
Error Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40001 | Request frequency exceeded. Retry later. |
| 40127 | Developer authentication failed. |
| 20059 | Agent has been deleted. |
