Back to Grafana

HTTP API

docs/sources/developer-resources/api-reference/http-api/_index.md

13.0.12.9 KB
Original Source

Grafana HTTP API reference

Every Grafana instance exposes an HTTP API, which is the same API used by the Grafana frontend to manage resources like saving dashboards, creating users, updating data sources, deleting alerts, and more. You can use the HTTP API to programmatically access or manage resources from your Grafana instance.

If you need to manage or access other resources from your Grafana Cloud Stack, refer to the Grafana Cloud API instead.

New generation HTTP APIs

Grafana is deprecating legacy APIs (/api) in favor of a new generation of improved APIs (/apis) which follow a standardized API structure alongside consistent API versioning. To learn more refer to the new API structure in Grafana.

These are the available new generation APIs:

Grafana API specification

HTTP API specs are available in Swagger:

You can browser and try out both via the Swagger UI editor (served by the Grafana server) by navigating to /swagger-ui.

Authenticate HTTP API requests

Grafana OSS

{{< docs/shared lookup="developers/authentication.md" source="grafana" version="<GRAFANA_VERSION>" >}}

Grafana Cloud

{{< docs/shared source="grafana-cloud" lookup="/developer-resources/authentication.md" version="" >}}

X-Grafana-Org-Id Header

X-Grafana-Org-Id is an optional property that specifies the organization to which the action is applied. If not set, the created key belongs to the current context org. Use this header in all requests except those regarding admin.

Example Request:

http
GET /api/org/ HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Grafana-Org-Id: 2
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk