Skip to main content
PUT
Set Agent Variable

Overview

Creates or replaces one variable in one of the agent’s environments. Reference it from the agent’s configuration as {{env.KEY}}; the value is substituted when a call runs as that environment. Writes to production apply to the next inbound call. See List Agent Variables for which environment resolves for each kind of call. Requires an admin, owner, operator, or prompter role.

Headers

string
required
Your API key for authentication.

Path Parameters

string
required
The agent’s unique identifier.
string
required
One of dev, staging, production. Any other value returns 400 INVALID_ENV.
string
required
The variable key. Letters, numbers, and underscores only (A-Z, a-z, 0-9, _); anything else, including dots and dashes, returns 400 INVALID_KEY. Surrounding whitespace is trimmed. Keys are case-sensitive as stored, so Api_Host and api_host are separate variables.

Body Parameters

any
required
The value to store. Any JSON value is accepted, including objects, arrays, and null; the field itself must be present or the request returns 400 MISSING_VALUE. A string that is exactly {{SECRET.NAME}} references an existing secret in your organization’s secret store and is expanded at call time, for example {{SECRET.CRM_API_KEY}}.
boolean
default:"false"
When true, value is converted to a string, stored in your organization’s secret store under a name derived from the agent, environment, and key, and the variable holds only the resulting {{SECRET.NAME}} reference. Reads return that reference, never the raw value. Saving the same key again with is_secret: true rotates the stored secret; saving it with is_secret: false removes the stored secret and keeps the plain value.

Response

string
The key that was written, as trimmed.
null | array
null on success, or a list of error objects if the request failed.

Docs for agents: llms.txt