Creates a new custom variable for the application. Use this endpoint to define dynamic values that can be injected into agent instructions.
Source types: Variables can source values from message metadata, user metadata, or a constant value.
Naming: Variable names must be unique within the app and follow the pattern [a-zA-Z][a-zA-Z0-9_.]*.
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Unique variable name. Must start with a letter and contain only alphanumeric characters, underscores, and dots.
50^[a-zA-Z][a-zA-Z0-9_.]*$"user.preferred_language"
Source from which the variable value is resolved
message_metadata, user_metadata, constant "user_metadata"
Human-readable description of the variable
200"The preferred language of the user"
Dot-notation path to extract the value from the source metadata
100"language"
Fixed value used when sourceType is constant
500"en"
Fallback value used when the source path does not resolve
200"en"
Custom variable created successfully
"507f1f77bcf86cd799439011"
"my-app-id"
"user.plan"
"The user subscription plan"
message_metadata, user_metadata, constant "user_metadata"
"metadata.plan"
""
"free"
custom "custom"
1700000000000
1700000000000