For the base URL, authentication and errors, see the REST API overview.
GET /v1/users/{user}/roles
- Request: GET /v1/users/{user}/roles
- Operation: ListRoles
- Operation ID:
Role_List - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes |
Example request
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles' \
-H 'Authorization: Bearer YOUR_TOKEN'Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
Response example (200)
[
{
"allow": {
"Alarm": {
"*": [
"List*",
"Read*",
"UpdateAlarmInstance"
]
},
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*",
"AccessDeviceResources"
]
}
},
"created": 1792263090707,
"enabled": true,
"modified": 1792263090707,
"role": "operator"
},
{
"allow": {
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*"
]
}
},
"created": 1792263090707,
"enabled": true,
"modified": 1792263090707,
"role": "viewer"
}
]POST /v1/users/{user}/roles
- Request: POST /v1/users/{user}/roles
- Operation: CreateRole
- Operation ID:
Role_Create - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes |
Request body (application/json, required)
A global role is a named set of permissions of the account, reusable by members of any of its projects (members.global_roles). Permissions: {<resource type>: {<resource id or *>: action | [actions]}}; actions accept a trailing * (Read*, List*).
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
allow | object | no | ||
allow.* | object | no | Minimum properties: 1 | |
allow.*.* | string or array of string or object | no | ||
allow.*.* | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 1: |
allow.*.* | array of string or object | no | Variant 2: | |
allow.*.*[] | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 2: Variant 1: |
allow.*.*[] | object | no | Variant 2: Variant 2: | |
allow.*.*[].* | string or array of string | no | Variant 1: Pattern: ^[a-zA-Z0-9_\*]{1,32}$|^\*$ | Variant 2: Variant 2: |
deny | object | no | ||
deny.* | object | no | Minimum properties: 1 | |
deny.*.* | string or array of string or object | no | ||
deny.*.* | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 1: |
deny.*.* | array of string or object | no | Variant 2: | |
deny.*.*[] | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 2: Variant 1: |
deny.*.*[] | object | no | Variant 2: Variant 2: | |
deny.*.*[].* | string or array of string | no | Variant 1: Pattern: ^[a-zA-Z0-9_\*]{1,32}$|^\*$ | Variant 2: Variant 2: |
enabled | boolean | yes | ||
role | string | yes | Pattern: ^[a-zA-Z0-9_-]{1,32}$ | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. |
Example request: Operator
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/roles' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"allow": {
"Alarm": {
"*": [
"List*",
"Read*",
"UpdateAlarmInstance"
]
},
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*",
"AccessDeviceResources"
]
}
},
"enabled": true,
"role": "operator"
}'Example body: Viewer
{
"allow": {
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*"
]
}
},
"enabled": true,
"role": "viewer"
}Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
GET /v1/users/{user}/roles/{role}
- Request: GET /v1/users/{user}/roles/
- Operation: ReadRoleConfig
- Operation ID:
Role_ReadConfig - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes | |
role | path | string | yes |
Example request
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \
-H 'Authorization: Bearer YOUR_TOKEN'Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
Response example (200, Operator)
{
"allow": {
"Alarm": {
"*": [
"List*",
"Read*",
"UpdateAlarmInstance"
]
},
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*",
"AccessDeviceResources"
]
}
},
"created": 1792263090707,
"enabled": true,
"modified": 1792263090707,
"role": "operator"
}Response example (200, Viewer)
{
"allow": {
"Bucket": {
"*": [
"List*",
"Read*"
]
},
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*"
]
}
},
"created": 1792263090707,
"enabled": true,
"modified": 1792263090707,
"role": "viewer"
}PUT /v1/users/{user}/roles/{role}
- Request: PUT /v1/users/{user}/roles/
- Operation: UpdateRole
- Operation ID:
Role_Update - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes | |
role | path | string | yes |
Request body (application/json, required)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
allow | object | no | ||
allow.* | object | no | Minimum properties: 1 | |
allow.*.* | string or array of string or object | no | ||
allow.*.* | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 1: |
allow.*.* | array of string or object | no | Variant 2: | |
allow.*.*[] | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 2: Variant 1: |
allow.*.*[] | object | no | Variant 2: Variant 2: | |
allow.*.*[].* | string or array of string | no | Variant 1: Pattern: ^[a-zA-Z0-9_\*]{1,32}$|^\*$ | Variant 2: Variant 2: |
deny | object | no | ||
deny.* | object | no | Minimum properties: 1 | |
deny.*.* | string or array of string or object | no | ||
deny.*.* | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 1: |
deny.*.* | array of string or object | no | Variant 2: | |
deny.*.*[] | string | no | Pattern: ^[a-zA-Z0-9_\*]{1,64}$|^\*$ | Variant 2: Variant 1: |
deny.*.*[] | object | no | Variant 2: Variant 2: | |
deny.*.*[].* | string or array of string | no | Variant 1: Pattern: ^[a-zA-Z0-9_\*]{1,32}$|^\*$ | Variant 2: Variant 2: |
enabled | boolean | no |
Example request: Disable the role
curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"enabled": false
}'Example body: Replace its permissions
{
"allow": {
"Dashboard": {
"*": [
"List*",
"Read*"
]
},
"Device": {
"*": [
"List*",
"Read*"
]
}
}
}Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
DELETE /v1/users/{user}/roles/{role}
- Request: DELETE /v1/users/{user}/roles/
- Operation: DeleteRole
- Operation ID:
Role_Delete - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes | |
role | path | string | yes |
Example request
curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \
-H 'Authorization: Bearer YOUR_TOKEN'Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
GET /v1/users/{user}/roles/{role}/clone
- Request: GET /v1/users/{user}/roles/{role}/clone
- Operation: CloneRoleConfig
- Operation ID:
Role_CloneConfig - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes | |
role | path | string | yes |
Example request
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE/clone' \
-H 'Authorization: Bearer YOUR_TOKEN'Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |
POST /v1/users/{user}/roles/{role}/clone
- Request: POST /v1/users/{user}/roles/{role}/clone
- Operation: CloneRole
- Operation ID:
Role_Clone - Authentication: access token,
Authorization: Bearer YOUR_TOKEN
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | yes | |
role | path | string | yes |
Request body (application/json, required)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
description | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. |
enabled | boolean | no | ||
name | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. |
role | string | yes | Pattern: ^[a-zA-Z0-9_-]{1,32}$ | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. |
Example request: Copy with a new id
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE/clone' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"role": "copy_of_role"
}'Example body: Copy with name and description
{
"description": "Same configuration as the original, for production line 2",
"name": "Line 2 copy",
"role": "line_2_role"
}Responses
| Status | Description |
|---|---|
| 200 | ok |
| 401 | unauthorized |
| 403 | forbidden |