---
title: "Update an existing variable on a task"
method: PUT
path: "/cmmn-runtime/tasks/{taskId}/variables/{variableName}"
tags: ["Task Variables"]
---

# Update an existing variable on a task

`PUT /cmmn-runtime/tasks/{taskId}/variables/{variableName}`

## Request

- Base URL: `https://developer-docs.flowable.com/cmmn-api`
- URL: `https://developer-docs.flowable.com/cmmn-api/cmmn-runtime/tasks/{taskId}/variables/{variableName}`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/docs/cmmn-runtime/tasks/:taskId/variables/:variableName/put.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint can be used in 2 ways: By passing a JSON Body (RestVariable) or by passing a multipart/form-data Object.
It is possible to update simple (non-binary) variable or  binary variable 
Any number of variables can be passed into the request body array.
NB: Swagger V2 specification does not support this use case that is why this endpoint might be buggy/incomplete if used with other tools.

## Path parameters

- `taskId` string, required
- `variableName` string, required

## Request body

- TaskVariableResource

## Response `200`

Indicates the variables was updated and the result is returned.

- RestVariable
  - `name` string: Name of the variable
  - `type` string: Type of the variable.
  - `value` object: Value of the variable.
  - `valueUrl` string
  - `scope` string

## Other responses

- `400`: Indicates the name of a variable to update was missing or that an attempt is done to update a variable on a standalone task (without a process associated) with scope global. Status message provides additional information.
- `404`: Indicates the requested task was not found or the task does not have a variable with the given name in the given scope. Status message contains additional information about the error.
- `415`: Indicates the serializable data contains an object for which no class is present in the JVM running the Flowable engine and therefore cannot be deserialized.

---

[API](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api.md) - [All operations](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/revisions/afdfa1fcacd0?raw)
