2022-05-26 23:06:25 +08:00
---
aliases:
2022-12-10 00:36:04 +08:00
- ../../http_api/licensing/
2023-02-07 01:14:36 +08:00
canonical: /docs/grafana/latest/developers/http_api/licensing/
2022-05-26 23:06:25 +08:00
description: Enterprise Licensing HTTP API
keywords:
- grafana
- http
- documentation
- api
- licensing
- enterprise
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: Licensing HTTP API
2022-05-26 23:06:25 +08:00
---
2021-01-20 01:09:05 +08:00
2021-04-16 04:56:29 +08:00
# Enterprise License API
2025-03-06 20:59:08 +08:00
Licensing is only available in Grafana Enterprise. Read more about [Grafana Enterprise ](/docs/grafana/latest/introduction/grafana-enterprise/ ).
2021-01-20 01:09:05 +08:00
2024-08-29 17:50:11 +08:00
{{< admonition type = "caution" > }}
You can't authenticate to the Licensing HTTP API with service account tokens.
Service accounts are limited to an organization and an organization role.
They can't be granted [Grafana server administrator permissions ](/docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/#grafana-server-administrators ).
To use these API endpoints you have to use Basic authentication and the Grafana user must have the Grafana server administrator permission.
The `admin` user that Grafana is provisioned with by default has permissions to use these API endpoints.
{{< / admonition > }}
2025-03-06 20:59:08 +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](/docs/grafana/latest/administration/roles-and-permissions/access-control/custom-role-actions-scopes/) for more information.
2021-10-06 00:35:01 +08:00
2021-04-22 03:31:38 +08:00
## Check license availability
> **Note:** Available in Grafana Enterprise v7.4+.
`GET /api/licensing/check`
Checks if a valid license is available.
2022-05-21 03:48:52 +08:00
**Required permissions**
2021-10-06 00:35:01 +08:00
2025-03-06 20:59:08 +08:00
See note in the [introduction ](#enterprise-license-api ) for an explanation.
2021-10-06 00:35:01 +08:00
| Action | Scope |
| -------------- | ----- |
| licensing:read | n/a |
### Examples
2021-04-22 03:31:38 +08:00
**Example request:**
```http
GET /api/licensing/check
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4
true
```
Status codes:
- **200** - OK
2022-09-23 17:57:51 +08:00
## Add license
2023-05-23 04:45:28 +08:00
{{% admonition type="note" %}}
Available in Grafana Enterprise v7.4+.
{{% /admonition %}}
2022-09-23 17:57:51 +08:00
`POST /api/licensing/token`
Applies a license to a Grafana instance.
**Required permissions**
2025-03-06 20:59:08 +08:00
See note in the [introduction ](#enterprise-license-api ) for an explanation.
2022-09-23 17:57:51 +08:00
| Action | Scope |
| --------------- | ----- |
| licensing:write | n/a |
### Examples
**Example request:**
```http
POST /licensing/token
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aGlzIjoiaXMiLCJub3QiOiJhIiwidmFsaWQiOiJsaWNlbnNlIn0.bxDzxIoJlYMwiEYKYT_l2s42z0Y30tY-6KKoyz9RuLE"}
```
**Example response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 357
{
"jti":"2",
"iss":"https://grafana.com",
"sub":"https://play.grafana.org/"
"lid":"1",
"included_users":15,
"lic_exp_warn_days":30,
"tok_exp_warn_days":2,
"update_days":1,
"prod":["grafana-enterprise"],
"company":"Grafana Labs"
}
```
The response is a JSON blob available for debugging purposes. The
available fields may change at any time without any prior notice.
Status Codes:
- **200** - OK
- **400** - Bad request
- **500** - Internal server error (refer to server logs for more details)
2021-01-20 01:09:05 +08:00
## Manually force license refresh
2023-05-23 04:45:28 +08:00
{{% admonition type="note" %}}
Available in Grafana Enterprise v7.4+.
{{% /admonition %}}
2021-01-20 01:09:05 +08:00
`POST /api/licensing/token/renew`
Manually ask license issuer for a new token.
2022-05-21 03:48:52 +08:00
**Required permissions**
2021-10-06 00:35:01 +08:00
2025-03-06 20:59:08 +08:00
See note in the [introduction ](#enterprise-license-api ) for an explanation.
2021-10-06 00:35:01 +08:00
2022-06-02 20:14:48 +08:00
| Action | Scope |
| --------------- | ----- |
| licensing:write | n/a |
2021-10-06 00:35:01 +08:00
### Examples
2021-01-20 01:09:05 +08:00
**Example request:**
```http
POST /api/licensing/token/renew
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{}
```
**Example response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 357
{
"jti":"2",
"iss":"https://grafana.com",
"sub":"https://play.grafana.org/"
"lid":"1",
2022-09-23 17:57:51 +08:00
"included_users":15,
2021-01-20 01:09:05 +08:00
"lic_exp_warn_days":30,
"tok_exp_warn_days":2,
"update_days":1,
"prod":["grafana-enterprise"],
"company":"Grafana Labs"
}
```
The response is a JSON blob available for debugging purposes. The
available fields may change at any time without any prior notice.
Status Codes:
- **200** - OK
- **401** - Unauthorized
- **403** - Access denied
## Remove license from database
2023-05-23 04:45:28 +08:00
{{% admonition type="note" %}}
Available in Grafana Enterprise v7.4+.
{{% /admonition %}}
2021-01-20 01:09:05 +08:00
`DELETE /api/licensing/token`
Removes the license stored in the Grafana database.
2022-05-21 03:48:52 +08:00
**Required permissions**
2021-10-06 00:35:01 +08:00
2025-03-06 20:59:08 +08:00
See note in the [introduction ](#enterprise-license-api ) for an explanation.
2021-10-06 00:35:01 +08:00
| Action | Scope |
| ---------------- | ----- |
| licensing:delete | n/a |
### Examples
2021-01-20 01:09:05 +08:00
**Example request:**
```http
DELETE /api/licensing/token
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{"instance": "http://play.grafana.org/"}
```
JSON Body schema:
- **instance** – Root URL for the instance for which the license should be deleted. Required.
**Example response:**
```http
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: 2
{}
```
Status codes:
- **202** - Accepted, license removed or did not exist.
- **401** - Unauthorized
- **403** - Access denied
- **422** - Unprocessable entity, incorrect instance name provided.