---
title: "Save device attributes (saveDeviceAttributes)"
method: POST
path: "/api/plugins/telemetry/{deviceId}/{scope}"
tags: ["telemetry-controller"]
---

# Save device attributes (saveDeviceAttributes)

`POST /api/plugins/telemetry/{deviceId}/{scope}`

Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example:

```json
{
 "stringKey":"value1", 
 "booleanKey":true, 
 "doubleKey":42.0, 
 "longKey":73, 
 "jsonKey": {
    "someNumber": 42,
    "someArray": [1,2,3],
    "someNestedObject": {"key": "value"}
 }
}
```


Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority.

## Path parameters

- `deviceId` string, required
- `scope` 'SERVER_SCOPE' | 'SHARED_SCOPE', required

## Request body

- string

## Response `200`

Attribute from the request was created or updated. Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED', and also sends event msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'.

- string

## Other responses

- `400` — Invalid structure of the request or invalid attributes scope provided.
- `401` — User is not authorized to save device attributes for selected device. Most likely, User belongs to different Customer or Tenant.
- `500` — The exception was thrown during processing the request. Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an error stacktrace.

---

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