2021-01-20 01:09:05 +08:00
+++
2022-05-21 02:35:28 +08:00
aliases = ["/docs/grafana/latest/developers/http_api/licensing/", "/docs/grafana/latest/http_api/licensing/"]
2021-04-16 04:56:29 +08:00
description = "Enterprise Licensing HTTP API"
2021-01-20 01:09:05 +08:00
keywords = ["grafana", "http", "documentation", "api", "licensing", "enterprise"]
2022-05-17 23:24:11 +08:00
title = "Licensing HTTP API "
2021-01-20 01:09:05 +08:00
+++
2021-04-16 04:56:29 +08:00
# Enterprise License API
2022-05-21 01:46:27 +08:00
Licensing is only available in Grafana Enterprise. Read more about [Grafana Enterprise ]({{< relref "../../enterprise" >}} ).
2021-01-20 01:09:05 +08:00
2022-05-21 01:46:27 +08:00
If you are running Grafana Enterprise and have [Role-based access control ]({{< relref "../../enterprise/access-control/_index.md" >}} ) enabled, for some endpoints you would need to have relevant permissions.
2021-10-06 00:35:01 +08:00
Refer to specific resources to understand what permissions are required.
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.
2021-10-06 00:35:01 +08:00
### Required permissions
See note in the [introduction ]({{< ref "#enterprise-license-api" >}} ) for an explanation.
| 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
2021-01-20 01:09:05 +08:00
## Manually force license refresh
> **Note:** Available in Grafana Enterprise v7.4+.
`POST /api/licensing/token/renew`
Manually ask license issuer for a new token.
2021-10-06 00:35:01 +08:00
### Required permissions
See note in the [introduction ]({{< ref "#enterprise-license-api" >}} ) for an explanation.
| Action | Scope |
| ---------------- | ----- |
| licensing:update | n/a |
### 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",
"included_admins":5,
"included_viewers":10,
"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
> **Note:** Available in Grafana Enterprise v7.4+.
`DELETE /api/licensing/token`
Removes the license stored in the Grafana database.
2021-10-06 00:35:01 +08:00
### Required permissions
See note in the [introduction ]({{< ref "#enterprise-license-api" >}} ) for an explanation.
| 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.