PUT/conversations/{conversation_id}/variables/{variable_id}

Update Conversation Variable

Available for: Chatflow, Chatbot, Legacy Agent apps.

Updates a conversation variable's value. The new value must match the variable's existing type.

2 parameters · 2 body fields
conversation_idstringrequired
ID of the conversation that owns the variable. Get conversation IDs from [List Conversations](/en/api-reference/conversations/list-conversations).
variable_idstringrequired
ID of the variable to update. Get variable IDs from [List Conversation Variables](/en/api-reference/conversations/list-conversation-variables).
userstringoptional
End-user identifier, defined by your app and unique within it. See [End User Identity](/en/api-reference/guides/end-user-identity).
valueunknownrequired
The new value for the variable. Must match the variable's expected type.

3 status codes
200Variable updated successfully.
created_atintegeroptional
Creation timestamp.
descriptionstringoptional
Variable description.
idstringoptional
Variable ID.
namestringoptional
Variable name.
updated_atintegeroptional
Last update timestamp.
valuestringoptional
Variable value (can be a JSON string for complex types).
value_typestringoptional
Variable value type. Possible values: `string`, `number`, `object`, `secret`, `file`, `boolean`, `array[any]`, `array[string]`, `array[number]`, `array[object]`, `array[file]`, `array[boolean]`.
400- `not_chat_app` : App mode does not match the API route. - `bad_request` : Variable value type mismatch.

2 documented failures

  • not_chat_app

    Please check if your app mode matches the right API route.

    not_chat_app

  • bad_request

    Type mismatch: variable 'user_preference' expects string, but got number type

    bad_request

404- `not_found` : Conversation does not exist. - `not_found` : Conversation variable does not exist.

One documented failure

  • not_found

    Conversation Not Exists.

    not_found

Error handling

A 400 is returned: - not_chat_app : App mode does not match the API route.

  • bad_request : Variable value type mismatch. A 404 is returned: - not_found : Conversation does not exist.
  • not_found : Conversation variable does not exist.