Skip to main content
POST
Create a variable

Authorizations

Authorization
string
header
required

A project API key, created in the dashboard.

Headers

Idempotency-Key
string

A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.

Required string length: 1 - 255

Body

application/json
agent_id
string
required
Maximum string length: 64
name
string
required

Letters, numbers, and underscores, starting with a letter. Must be unique within the AI agent, and case-sensitive: order_id and Order_ID are different variables. System variable names and other reserved names, such as contact_email and conversation_id, aren't allowed.

Maximum string length: 50
Pattern: ^[a-zA-Z][a-zA-Z0-9_]*$
description
string | null
Maximum string length: 255
default_value
string | null
Maximum string length: 500

Response

The new variable.

object
any
required
id
string
required
Example:

"7c9e6679-7425-40de-944b-e07fc1f90ae7"

agent
object
required

The agent this belongs to.

name
string
required
Example:

"order_id"

kind
enum<string>
required

system variables are read-only.

Available options:
custom,
system
type
enum<string>
required

Custom variables are always string.

Available options:
string,
number,
boolean,
date
description
string | null
required

What the variable stores. For system variables, the built-in description.

default_value
string | null
required

The value a conversation starts with. Always null for system variables.

created_at
string<date-time> | null
required
updated_at
string<date-time> | null
required