---
title: "Authentication options for the HTTP API | Grafana documentation"
description: "You can authenticate HTTP API requests using basic authentication or a service account token."
---

# Authentication (deprecated)

## Authentication options for the HTTP API for 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/next/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>`* .

## Authentication options for the HTTP API in 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>
```
