---
title: "HTTP API | Grafana documentation"
description: "Grafana HTTP API"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# 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 running in Grafana Cloud. Below is the list of existing [HTTP APIs](#http-apis).

HTTP API details are [specified](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgrafana%2Fgrafana%2Fmain%2Fpublic%2Fapi-merged.json) using OpenAPI v2.

There is also an [OpenAPI v3 specification](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgrafana%2Fgrafana%2Fmain%2Fpublic%2Fopenapi3.json) (generated by the v2 one).

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

> Note
> 
> If you need to manage or access other resources from your [Grafana Cloud Stack](/docs/grafana-cloud/account-management/cloud-stacks/), refer to the [Grafana Cloud API](../cloud-api/) instead.

## Authenticate HTTP API requests

### Grafana OSS

You can authenticate HTTP API requests using basic authentication or a service account token.

### Basic auth

If basic auth is enabled (it is enabled by default), then you can authenticate your HTTP request via standard basic auth. Basic auth will also authenticate LDAP users.

curl example:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
curl http://admin:admin@localhost:3000/api/org
{"id":1,"name":"Main Org."}
```

### Service account token

To create a service account token, click on **Administration** in the left-side menu, click **Users and access**, then **Service Accounts**. For more information on how to use service account tokens, refer to the [Service Accounts](/docs/grafana/v12.4/administration/service-accounts/) documentation.

You use the token in all requests in the `Authorization` header, like this:

**Example**:

http ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```http
GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

The `Authorization` header value should be *`Bearer <YOUR_SERVICE_ACCOUNT_TOKEN>`* .

### Grafana Cloud

To use the HTTP API provided by a Grafana Cloud instance, authenticate requests with a service account token.

To access or create your service account tokens, click on **Administration** in the left-side menu, click **Users and access**, then **Service Accounts**. For details on creating service accounts, assigning permissions, and adding tokens, refer to [Service Accounts](/docs/grafana-cloud/account-management/authentication-and-permissions/service-accounts/).

Include the service account token in the `Authorization` header for all requests to your Grafana instance:

http ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```http
GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

Requests to the HTTP API are authenticated using the `Authorization` header:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
Authorization: Bearer <SERVICE ACCOUNT TOKEN>
```

## X-Grafana-Org-Id Header

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

**Example Request**:

http ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

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

## HTTP APIs

- [Admin API](admin/)
- [Alerting API (unstable)](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgrafana%2Fgrafana%2Fmain%2Fpkg%2Fservices%2Fngalert%2Fapi%2Ftooling%2Fpost.json)
- [Alerting provisioning API](alerting_provisioning/)
- [Annotations API](annotations/)
- [Correlations API](correlations/)
- [Dashboard API](dashboard/)
- [Dashboard permissions API](dashboard_permissions/)
- [Dashboard versions API](dashboard_versions/)
- [Data source API](data_source/)
- [Folder API](folder/)
- [Folder permissions API](folder_permissions/)
- [Folder/Dashboard search API](folder_dashboard_search/)
- [Library element API](library_element/)
- [Organization API](org/)
- [Other API](other/)
- [Playlists API](playlist/)
- [Preferences API](preferences/)
- [Shared dashboards API](dashboard_public/)
- [Query history API](query_history/)
- [Service account API](serviceaccount/)
- [Short URL API](short_url/)
- [Snapshot API](snapshot/)
- [SSO settings API](sso-settings/)
- [Team API](team/)
- [User API](user/)

## Grafana Enterprise HTTP APIs

Grafana Enterprise includes all of the Grafana OSS APIs as well as the following APIs:

- [Data source permissions API](datasource_permissions/)
- [License API](licensing/)
- [Query and resource caching API](query_and_resource_caching/)
- [Reporting API](reporting/)
- [Role-based access control API](access_control/)
- [Secrets Management API](secrets_management/)
- [Team sync API](team_sync/)

## Deprecated HTTP APIs

- [Authentication API](authentication/)
