2022-05-26 23:06:25 +08:00
---
aliases:
2022-12-10 00:36:04 +08:00
- ../../http_api/dashboard_permissions/
- ../../http_api/dashboardpermissions/
2023-02-07 01:14:36 +08:00
canonical: /docs/grafana/latest/developers/http_api/dashboard_permissions/
2022-05-26 23:06:25 +08:00
description: Grafana Dashboard Permissions HTTP API
keywords:
- grafana
- http
- documentation
- api
- dashboard
- permission
- permissions
- acl
Explicitly set all front matter labels in the source files (#71548)
* Set every page to have defaults of 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/enterprise-licensing pages to have 'Enterprise' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/recorded-queries pages to have labels cloud,enterprise
* Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/stats-and-license pages to have labels cloud,enterprise
* Set alerting pages to have labels cloud,enterprise,oss
* Set breaking-changes pages to have labels cloud,enterprise,oss
* Set dashboards pages to have labels cloud,enterprise,oss
* Set datasources pages to have labels cloud,enterprise,oss
* Set explore pages to have labels cloud,enterprise,oss
* Set fundamentals pages to have labels cloud,enterprise,oss
* Set introduction/grafana-cloud pages to have labels cloud
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Fix introduction pages products
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set panels-visualizations pages to have labels cloud,enterprise,oss
* Set release-notes pages to have labels cloud,enterprise,oss
* Set search pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set troubleshooting pages to have labels cloud,enterprise,oss
* Set whatsnew pages to have labels cloud,enterprise,oss
* Apply updated labels from review
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
---------
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
2023-07-18 16:10:12 +08:00
labels:
products:
- enterprise
- oss
2022-12-10 00:36:04 +08:00
title: Dashboard Permissions HTTP API
2022-05-26 23:06:25 +08:00
---
2018-02-06 00:12:22 +08:00
2018-02-12 21:50:35 +08:00
# Dashboard Permissions API
2018-02-06 00:12:22 +08:00
2018-02-21 20:09:54 +08:00
This API can be used to update/get the permissions for a dashboard.
2018-02-06 00:12:22 +08:00
2018-02-12 21:50:35 +08:00
Permissions with `dashboardId=-1` are the default permissions for users with the Viewer and Editor roles. Permissions can be set for a user, a team or a role (Viewer or Editor). Permissions cannot be set for Admins - they always have access to everything.
2018-02-06 00:12:22 +08:00
The permission levels for the permission field:
- 1 = View
- 2 = Edit
- 4 = Admin
2023-03-16 01:06:31 +08:00
> If you are running Grafana Enterprise, for some endpoints you'll need to have specific permissions. Refer to [Role-based access control permissions]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/access-control/custom-role-actions-scopes" >}}) for more information.
2022-05-21 03:48:52 +08:00
2018-02-21 20:09:54 +08:00
## Get permissions for a dashboard
2018-02-06 00:12:22 +08:00
2022-04-21 22:24:03 +08:00
`GET /api/dashboards/uid/:uid/permissions`
Gets all existing permissions for the dashboard with the given `uid` .
2022-05-21 03:48:52 +08:00
**Required permissions**
See note in the [introduction ]({{< ref "#dashboard-permission-api" >}} ) for an explanation.
| Action | Scope |
| ----------------------------- | ------------------------------------- |
| `dashboards.permissions:read` | `dashboards:uid:*` < br > `folders:uid:*` |
2022-04-21 22:24:03 +08:00
**Example request**:
```http
GET /api/dashboards/uid/dHEquNzGz/permissions HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 551
[
{
"id": 1,
"dashboardId": -1,
"created": "2017-06-20T02:00:00+02:00",
"updated": "2017-06-20T02:00:00+02:00",
"userId": 0,
"userLogin": "",
"userEmail": "",
"teamId": 0,
"team": "",
"role": "Viewer",
"permission": 1,
"permissionName": "View",
"uid": "dHEquNzGz",
"title": "",
"slug": "",
"isFolder": false,
"url": ""
},
{
"id": 2,
"dashboardId": -1,
"created": "2017-06-20T02:00:00+02:00",
"updated": "2017-06-20T02:00:00+02:00",
"userId": 0,
"userLogin": "",
"userEmail": "",
"teamId": 0,
"team": "",
"role": "Editor",
"permission": 2,
"permissionName": "Edit",
"uid": "dHEquNzGz",
"title": "",
"slug": "",
"isFolder": false,
"url": ""
}
]
```
Status Codes:
- **200** - Ok
- **401** - Unauthorized
- **403** - Access denied
- **404** - Dashboard not found
## Update permissions for a dashboard
`POST /api/dashboards/uid/:uid/permissions`
Updates permissions for a dashboard. This operation will remove existing permissions if they're not included in the request.
2022-05-21 03:48:52 +08:00
**Required permissions**
See note in the [introduction ]({{< ref "#dashboard-permission-api" >}} ) for an explanation.
| Action | Scope |
| ------------------------------ | ------------------------------------- |
| `dashboards.permissions:write` | `dashboards:uid:*` < br > `folders:uid:*` |
2022-04-21 22:24:03 +08:00
**Example request**:
```http
POST /api/dashboards/uid/dHEquNzGz/permissions
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"items": [
{
"role": "Viewer",
"permission": 1
},
{
"role": "Editor",
"permission": 2
},
{
"teamId": 1,
"permission": 1
},
{
"userId": 11,
"permission": 4
}
]
}
```
JSON body schema:
- **items** - The permission items to add/update. Items that are omitted from the list will be removed.
**Example response**:
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 35
{"message":"Dashboard permissions updated"}
```
Status Codes:
- **200** - Ok
- **401** - Unauthorized
- **403** - Access denied
- **404** - Dashboard not found
## Get permissions for a dashboard by id
2023-05-23 04:45:28 +08:00
{{% admonition type="warning" %}}
This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new dashboard permissions API ](#get-permissions-for-a-dashboard ).
{{% /admonition %}}
2022-04-21 22:24:03 +08:00
2018-02-21 20:09:54 +08:00
`GET /api/dashboards/id/:dashboardId/permissions`
2018-02-06 00:12:22 +08:00
2018-02-21 20:09:54 +08:00
Gets all existing permissions for the dashboard with the given `dashboardId` .
2018-02-06 00:12:22 +08:00
2022-05-21 03:48:52 +08:00
**Required permissions**
See note in the [introduction ]({{< ref "#dashboard-permission-api" >}} ) for an explanation.
| Action | Scope |
| ----------------------------- | ----------------------------- |
| `dashboards.permissions:read` | `dashboards:*` < br > `folders:*` |
2018-02-12 21:50:35 +08:00
**Example request**:
2018-02-06 00:12:22 +08:00
```http
2018-02-21 20:09:54 +08:00
GET /api/dashboards/id/1/permissions HTTP/1.1
2018-02-06 00:12:22 +08:00
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 551
[
{
"id": 1,
"dashboardId": -1,
"created": "2017-06-20T02:00:00+02:00",
"updated": "2017-06-20T02:00:00+02:00",
"userId": 0,
"userLogin": "",
"userEmail": "",
"teamId": 0,
"team": "",
"role": "Viewer",
"permission": 1,
"permissionName": "View",
"uid": "",
"title": "",
"slug": "",
"isFolder": false,
"url": ""
},
{
"id": 2,
"dashboardId": -1,
"created": "2017-06-20T02:00:00+02:00",
"updated": "2017-06-20T02:00:00+02:00",
"userId": 0,
"userLogin": "",
"userEmail": "",
"teamId": 0,
"team": "",
"role": "Editor",
"permission": 2,
"permissionName": "Edit",
"uid": "",
"title": "",
"slug": "",
"isFolder": false,
"url": ""
}
]
```
Status Codes:
- **200** - Ok
2018-02-12 21:50:35 +08:00
- **401** - Unauthorized
2018-02-06 00:12:22 +08:00
- **403** - Access denied
2018-02-21 20:09:54 +08:00
- **404** - Dashboard not found
2018-02-06 00:12:22 +08:00
2022-04-21 22:24:03 +08:00
## Update permissions for a dashboard by id
2023-05-23 04:45:28 +08:00
{{% admonition type="warning" %}}
This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new dashboard permissions API ](#update-permissions-for-a-dashboard ).
{{% /admonition %}}
2018-02-06 00:12:22 +08:00
2018-02-21 20:09:54 +08:00
`POST /api/dashboards/id/:dashboardId/permissions`
2018-02-06 00:12:22 +08:00
2018-02-21 20:09:54 +08:00
Updates permissions for a dashboard. This operation will remove existing permissions if they're not included in the request.
2018-02-06 00:12:22 +08:00
2022-05-21 03:48:52 +08:00
**Required permissions**
See note in the [introduction ]({{< ref "#dashboard-permission-api" >}} ) for an explanation.
| Action | Scope |
| ------------------------------ | ----------------------------- |
| `dashboards.permissions:write` | `dashboards:*` < br > `folders:*` |
2018-02-12 21:50:35 +08:00
**Example request**:
2018-02-06 00:12:22 +08:00
```http
2018-02-21 20:09:54 +08:00
POST /api/dashboards/id/1/permissions
2018-02-06 00:12:22 +08:00
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
2018-05-11 10:19:28 +08:00
{
2018-02-06 00:12:22 +08:00
"items": [
{
"role": "Viewer",
"permission": 1
},
{
"role": "Editor",
"permission": 2
},
{
"teamId": 1,
"permission": 1
},
{
"userId": 11,
"permission": 4
}
]
}
```
JSON body schema:
2018-02-12 21:50:35 +08:00
- **items** - The permission items to add/update. Items that are omitted from the list will be removed.
2018-02-06 00:12:22 +08:00
**Example response**:
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 35
2018-02-21 20:09:54 +08:00
{"message":"Dashboard permissions updated"}
2018-02-06 00:12:22 +08:00
```
Status Codes:
- **200** - Ok
2018-02-12 21:50:35 +08:00
- **401** - Unauthorized
2018-02-06 00:12:22 +08:00
- **403** - Access denied
- **404** - Dashboard not found