Grafana
Grafana - REST API Reference
Served by Grafana backend
GET http://$GRAFANA_HOST:3000/swaggerGrafana - Health check
GET /api/health❯ http :3000/api/health
HTTP/1.1 200 OK
Cache-Control: no-store
Content-Length: 101
Content-Type: application/json; charset=UTF-8
Date: Fri, 03 Oct 2025 15:35:30 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
{
"commit": "92f1fba9b4b6700328e99e97328d6639df8ddc3d",
"database": "ok",
"version": "12.2.0"
}Grafana - Get all data sources
GET /api/datasources❯ http :3000/api/datasources
HTTP/1.1 200 OK
Cache-Control: no-store
Content-Type: application/json
Date: Fri, 03 Oct 2025 15:42:12 GMT
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
[
{
"access": "proxy",
"basicAuth": false,
"database": "",
"id": 1,
"isDefault": false,
"jsonData": {
"derivedFields": [
{
"datasourceUid": "tempo",
"matcherRegex": "^.*?traceI[d|D]=(\\w+).*$",
"name": "traceId",
"url": "${__value.raw}"
}
]
},
"name": "Loki",
"orgId": 1,
"readOnly": true,
"type": "loki",
"typeLogoUrl": "public/plugins/loki/img/loki_icon.svg",
"typeName": "Loki",
"uid": "loki",
"url": "http://loki:3100",
"user": ""
},
{
"access": "proxy",
"basicAuth": false,
"database": "",
"id": 3,
"isDefault": false,
"jsonData": {
"exemplarTraceIdDestinations": [
{
"datasourceUid": "tempo",
"name": "traceID"
}
],
"httpMethod": "POST",
"timeInterval": "2s"
},
"name": "Mimir",
"orgId": 1,
"readOnly": true,
"type": "prometheus",
"typeLogoUrl": "public/plugins/prometheus/img/prometheus_logo.svg",
"typeName": "Prometheus",
"uid": "mimir",
"url": "http://mimir:9009/prometheus",
"user": ""
},
{
"access": "proxy",
"basicAuth": false,
"database": "",
"id": 5,
"isDefault": false,
"jsonData": {
"database": "postgres",
"postgresVersion": 1400,
"sslmode": "disable"
},
"name": "Postgres",
"orgId": 1,
"readOnly": true,
"type": "grafana-postgresql-datasource",
"typeLogoUrl": "public/plugins/grafana-postgresql-datasource/img/postgresql_logo.svg",
"typeName": "PostgreSQL",
"uid": "postgres",
"url": "mythical-database:5432",
"user": "postgres"
},
{
"access": "proxy",
"basicAuth": false,
"database": "",
"id": 4,
"isDefault": false,
"jsonData": {
"backendType": "pyroscope"
},
"name": "Pyroscope",
"orgId": 1,
"readOnly": true,
"type": "grafana-pyroscope-datasource",
"typeLogoUrl": "public/plugins/grafana-pyroscope-datasource/img/grafana_pyroscope_icon.svg",
"typeName": "Grafana Pyroscope",
"uid": "pyroscope",
"url": "http://pyroscope:4040",
"user": ""
},
{
"access": "proxy",
"basicAuth": false,
"database": "",
"id": 2,
"isDefault": false,
"jsonData": {
"nodeGraph": {
"enabled": true
},
"serviceMap": {
"datasourceUid": "Mimir"
},
"tracesToLogs": {
"datasourceUid": "loki",
"filterByTraceID": false,
"spanEndTimeShift": "500ms",
"spanStartTimeShift": "-500ms",
"tags": [
"beast"
]
}
},
"name": "Tempo",
"orgId": 1,
"readOnly": true,
"type": "tempo",
"typeLogoUrl": "public/plugins/tempo/img/tempo_logo.svg",
"typeName": "Tempo",
"uid": "tempo",
"url": "http://tempo:3200",
"user": ""
}
]Set up
Docker Image
-
Admin account
# Environment variables GF_SECURITY_ADMIN_USER=$username GF_SECURITY_ADMIN_PASSWORD=$password -
Resources
Provisioning
- Grafana as code: A complete guide to managing Grafana as code: tools, tips, and tricks (opens in a new tab)
- Provision Grafana | Grafana documentation (opens in a new tab)
- GitHub - Examples provisioning alerting resources in Grafana (opens in a new tab)