# Hosted Grafana API

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Fapis%2Fgrafana%2Fhosted-grafana-api.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Fapis%2Fgrafana%2Fhosted-grafana-api.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

Coralogix provides a secure **hosted Grafana API** for creating, editing, exporting, importing, querying, and other Grafana API operations. Through Grafana APIs, you can manage your hosted Grafana dashboards.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

To use the Grafana API to query your dashboard, you will need:

* To [create](https://coralogix.com/docs/docs/user-guides/account-management/api-keys/api-keys/.md) a personal or team API key. It’s recommended to use permission presets, as they are automatically updated with all relevant permissions. Alternatively, you can manually add individual permissions.

  | Preset  | Action                               | Description                                            |
  | ------- | ------------------------------------ | ------------------------------------------------------ |
  | Grafana | `GRAFANA:READ`<br />`GRAFANA:UPDATE` | View Grafana Dashboards<br />Manage Grafana Dashboards |

* A Coralogix [domain](https://coralogix.com/docs/docs/user-guides/account-management/account-settings/coralogix-domain/.md)

## **HTTP Request for Your Hosted Grafana**[​](#http-request-for-your-hosted-grafana "Direct link to http-request-for-your-hosted-grafana")

The API key should be added as Coralogix token with each HTTP request. Your Coralogix Domain will be used to construct the Grafana API endpoint specific to your account.

The API request should contain the following:

* Headers:

  * ‘token:`<cx_api_key>`’

  * ‘Content-type: application/json‘

* URL: <!-- -->https\://api./grafana/api

## **Examples**[​](#examples "Direct link to examples")

* GET Home Dashboard

```
curl --location --request GET 'https://api.eu2.coralogix.com/grafana/api/dashboards/home' \

--header 'Content-type: application/json' \

--header 'Authorization: Bearer <cx_api_key>' \
```

* Search all dashboards in your team:

```
curl --location --request GET 'https://api.eu2.coralogix.com/grafana/api/search' \

--header 'Content-type: application/json' \

--header 'Authorization: Bearer <cx_api_key>' \
```

* Get a dashboard and panels by uid:

```
curl --location --request GET 'https://api.eu2.coralogix.com/grafana/api/dashboards/uid/<UID>' \

--header 'Content-type: application/json' \

--header 'Authorization: Bearer <cx_api_key>' \
```

* Post Dashboard - create and update existing dashboards:

```
curl --location 'https://api.eu2.coralogix.com/grafana/api/dashboards/db' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer <cx_api_key>' \

--data '<Dashboard JSON>'
```

* GET Annotations:

```
curl --location --request POST 'https://api.eu2.coralogix.com/grafana/api/dashboards/db' \

--header 'Content-type: application/json' \

--header 'Authorization: Bearer <cx_api_key>' \

--data-binary "@path/to/file"
```

## Additional Resources[​](#additional-resources "Direct link to Additional Resources")

* [Grafana’s HTTP API Reference](https://grafana.com/docs/grafana/v9.0/developers/http_api/)

* Grafana API supports the Host Grafana features.
