Chatbot Variables
The ID of the chatbot.
Filters variables by categories. Separate multiple filters with commas.
0: CUSTOM1: APP2: Entity
0,1List of all global variables.
Optional error message.
Insufficient permissions.
GET /v1/chatbots/{chatbotId}/variables HTTP/1.1
Host: api.chatcaptain.com
x-chatcaptain-key: YOUR_API_KEY
Accept: */*
{
"variables": [
{
"id": "gS9DWxRHUuRI9yDUjiWw",
"name": "customer_name",
"defaultValue": "Default value",
"category": "custom",
"label": "Customer Name",
"type": "string",
"readonly": false,
"created": "2025-10-04T10:00:00Z",
"updated": "2025-10-04T10:05:00Z",
"structureJson": "{\"firstName\": \"string\", \"lastName\": \"string\"}"
}
],
"error": "text"
}The ID of the chatbot.
The category of the variable.
customPossible values: An optional default value for the variable.
Default ValueThe human-readable label of the variable.
Customer EmailThe data type of the variable (e.g., "string", "number", "boolean", "object").
stringThe programmatic name of the variable.
customer_emailA JSON string defining the structure for object variables.
{"firstName": "string", "lastName": "string"}Sets the subCategory of the variable.
0: GLOBAL_VARIABLE_SUB_CATEGORY_CONVERSATION1: GLOBAL_VARIABLE_SUB_CATEGORY_CONTACT
Global variable created successfully.
Invalid input data.
Insufficient permissions.
POST /v1/chatbots/{chatbotId}/variables HTTP/1.1
Host: api.chatcaptain.com
x-chatcaptain-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 205
{
"category": "custom",
"defaultValue": "Default Value",
"label": "Customer Email",
"type": "string",
"name": "customer_email",
"structureJson": "{\"firstName\": \"string\", \"lastName\": \"string\"}",
"subCategory": 0
}{
"variable": {
"id": "gS9DWxRHUuRI9yDUjiWw",
"name": "customer_name",
"defaultValue": "Default value",
"category": "custom",
"label": "Customer Name",
"type": "string",
"readonly": false,
"created": "2025-10-04T10:00:00Z",
"updated": "2025-10-04T10:05:00Z",
"structureJson": "{\"firstName\": \"string\", \"lastName\": \"string\"}"
}
}The ID of the chatbot.
The ID of the variable to be deleted.
Result of the deletion process.
Indicates whether the variable was successfully deleted.
trueInsufficient permissions.
DELETE /v1/chatbots/{chatbotId}/variables/{variableId} HTTP/1.1
Host: api.chatcaptain.com
x-chatcaptain-key: YOUR_API_KEY
Accept: */*
{
"deleted": true
}The ID of the chatbot.
The ID of the variable to be updated.
The new default value.
Updated DefaultThe new label.
Updated LabelThe new programmatic name.
updated_variable_nameGlobal variable updated successfully.
Invalid input data.
Insufficient permissions.
PATCH /v1/chatbots/{chatbotId}/variables/{variableId} HTTP/1.1
Host: api.chatcaptain.com
x-chatcaptain-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 89
{
"defaultValue": "Updated Default",
"label": "Updated Label",
"name": "updated_variable_name"
}{
"variable": {
"id": "gS9DWxRHUuRI9yDUjiWw",
"name": "customer_name",
"defaultValue": "Default value",
"category": "custom",
"label": "Customer Name",
"type": "string",
"readonly": false,
"created": "2025-10-04T10:00:00Z",
"updated": "2025-10-04T10:05:00Z",
"structureJson": "{\"firstName\": \"string\", \"lastName\": \"string\"}"
}
}Last updated