---
updatedAt: 2026-05-06T16:59:40.000Z
agentTools:
  projectIndex: https://docs.ubidots.com/llms.txt
---

# Update Variable

This endpoint updates the Variable fields specified in the body.

## Request

To update one or more specific attributes of a Variable please make a PATCH request to the following URL:

| HTTP Method | URL                                                                    |
| :---------- | :--------------------------------------------------------------------- |
| PATCH       | `https://industrial.api.ubidots.com/api/v2.0/variables/<variable_id>/` |

To update one or more specific attributes of a Variable in a Device please make a PATCH request to the following URL:

| HTTP Method | URL                                                                                         |
| :---------- | :------------------------------------------------------------------------------------------ |
| PATCH       | `https://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/variables/<variable_key>` |

## Path Parameters

| Parameter      | Type   | Description            |
| :------------- | :----- | :--------------------- |
| variable\\\_id | String | The ID of the Variable |

## Query Parameters

| Parameter | Type   | Use            | Description                                                       |
| :-------- | :----- | :------------- | :---------------------------------------------------------------- |
| token     | String | Authentication | Authentication Token can optionally be sent as a query parameter. |

## Body Parameters

| Parameter           | Type         | Required? | Description                      |
| :------------------ | :----------- | :-------- | :------------------------------- |
| label               | String       | No        | The API label of Variable        |
| name                | String       | No        | Name of the Variable             |
| description         | String       | No        | Description of Variable          |
| tags                | String Array | No        | Variable tags                    |
| properties          | Object       | No        | Variable properties              |
| icon                | String       | No        | Icon of Variable                 |
| unit                | String       | No        | Unit of Variable.                |
| syntheticExpression | String       | No        | Synthetic Expression of Variable |

## Header

| Parameter    | Required? | Description                                                 |
| :----------- | :-------- | :---------------------------------------------------------- |
| X-Auth-Token | Yes       | [Authorization Token](https://docs.ubidots.com/reference/authentication) of account |

```curl cURL (Request)
$ curl -X PATCH 'https://industrial.api.ubidots.com/api/v2.0/variables/<variable_id>' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
    "label": "variable2",
    "name": "Variable 2",
    "description": "my variable 2",
    "tags": ["blue", "yellow"],
    "properties": {},
    "icon": "trash",
    "unit": "meters"
}'
```

```json 200 OK
{
    "createdAt": "2019-12-18T14:38:38.354415Z",
    "syntheticExpression": "",
    "description": "my variable 2",
    "device": {
        "id": "6e309da44fc8455a9cceb5aa",
        "label": "first-device",
        "name": "First Device",
        "url": "https://industrial.api.ubidots.com/api/v2.0/devices/6e309da44fc8455a9cceb5aa"
    },
    "icon": "trash",
    "id": "5dfa39ee1a9ca53020c69391",
    "label": "variable2",
    "lastActivity": null,
    "lastValue": {},
    "name": "Variable 2",
    "properties": {},
    "tags": ["blue", "yellow"],
    "type": "raw",
    "unit": "meters",
    "url": "https://industrial.api.ubidots.com/api/v2.0/variables/5dfa39ee1a9ca53020c69391",
    "valuesUrl": "https://industrial.api.ubidots.com/api/v1.6/variables/5dfa39ee1a9ca53020c69391/values"
}
```
```json 400 Bad Request
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
```
```json 401 Unauthorized
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}
```

## Response

Returns a [Variable object](https://docs.ubidots.com/reference/variable-object) of the updated Variable.