Skip to main content
PATCH
/
ai-agents
/
agent-builder
/
agents
/
variables
/
custom
/
{variableId}
Update Custom Variable
curl --request PATCH \
  --url https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents/variables/custom/{variableId} \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "description": "The preferred language of the user",
  "sourceType": "user_metadata",
  "sourcePath": "language",
  "constantValue": "en",
  "defaultValue": "en"
}
'
{
  "_id": "507f1f77bcf86cd799439011",
  "appId": "my-app-id",
  "name": "user.plan",
  "description": "Updated description",
  "sourceType": "user_metadata",
  "sourcePath": "metadata.plan",
  "constantValue": "",
  "defaultValue": "premium",
  "category": "custom",
  "createdAt": 1700000000000,
  "updatedAt": 1700000100000
}
For the complete error reference, see Error Guide.

Authorizations

apikey
string
header
required

API Key (i.e. Rest API Key from the Dashboard).

Path Parameters

variableId
string
required

Variable ID to update

Body

application/json
description
string

Human-readable description of the variable

Maximum string length: 200
Example:

"The preferred language of the user"

sourceType
enum<string>

Source from which the variable value is resolved

Available options:
message_metadata,
user_metadata,
constant
Example:

"user_metadata"

sourcePath
string

Dot-notation path to extract the value from the source metadata

Maximum string length: 100
Example:

"language"

constantValue
string

Fixed value used when sourceType is constant

Maximum string length: 500
Example:

"en"

defaultValue
string

Fallback value used when the source path does not resolve

Maximum string length: 200
Example:

"en"

Response

200 - application/json

Custom variable updated successfully

_id
string
Example:

"507f1f77bcf86cd799439011"

appId
string
Example:

"my-app-id"

name
string
Example:

"user.plan"

description
string
Example:

"The user subscription plan"

sourceType
enum<string>
Available options:
message_metadata,
user_metadata,
constant
Example:

"user_metadata"

sourcePath
string
Example:

"metadata.plan"

constantValue
string
Example:

"premium"

defaultValue
string
Example:

"free"

category
enum<string>
Available options:
custom
Example:

"custom"

createdAt
number
Example:

1700000000000

updatedAt
number
Example:

1700000000000