---
title: "Update Conversation Variable"
method: PUT
path: "/conversations/{conversation_id}/variables/{variable_id}"
tags: ["Conversations"]
---

# Update Conversation Variable

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

**Available for**: Chatflow, Chatbot, Agent apps.

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

## Path parameters

- `conversation_id` string, uuid, required
- `variable_id` string, uuid, required

## Request body

- ConversationVariableUpdateRequest — Request body for updating a conversation variable.
  - `value` unknown, required
  - `user` string — End-user identifier, defined by your app and unique within it. See [End User Identity](/en/api-reference/guides/end-user-identity).

## Response `200`

Variable updated successfully.

- ConversationVariableItem
  - `id` string, uuid — Variable ID.
  - `name` string — Variable name.
  - `value_type` string — Variable value type. Possible values: `string`, `number`, `object`, `secret`, `file`, `boolean`, `array[any]`, `array[string]`, `array[number]`, `array[object]`, `array[file]`, `array[boolean]`.
  - `value` string — Variable value (can be a JSON string for complex types).
  - `description` string — Variable description.
  - `created_at` integer — Creation timestamp.
  - `updated_at` integer — Last update timestamp.

## Other responses

- `400` — - `not_chat_app` : App mode does not match the API route. - `bad_request` : Variable value type mismatch.
- `404` — - `not_found` : Conversation does not exist. - `not_found` : Conversation variable does not exist.

---

[API](https://skmtc.net/langgenius/apis/dify-service-api.md) · [All operations](https://skmtc.net/langgenius/apis/dify-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langgenius/dify-service-api/revisions/e49b3db72bad/schema)
