Reporting API
This API allows you to interact programmatically with the Reporting feature.
The Reporting API is not stabilized yet, it is still in active development and may change without prior notice.
Reporting is only available in Grafana Enterprise. Read more about Grafana Enterprise.
If you are running Grafana Enterprise, for some endpoints you’ll need to have specific permissions. Refer to Role-based access control permissions for more information.
List all reports
GET /api/reports
Required permissions
See note in the introduction for an explanation.
Example request
GET /api/reports HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
Status Codes
- 200 – OK
- 401 - Authentication failed, refer to Authentication API.
- 500 – Unexpected error or server misconfiguration. Refer to server logs for more details.
Get a report
GET /api/reports/:id
Required permissions
See note in the introduction for an explanation.
Example request
GET /api/reports/2 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
Status Codes
- 200 – OK
- 400 – Bad request (invalid report ID).
- 401 - Authentication failed, refer to Authentication API.
- 403 – Forbidden (access denied to a report or a dashboard used in the report).
- 404 – Not found (such report does not exist).
- 500 – Unexpected error or server misconfiguration. Refer to server logs for more details.
Create a report
POST /api/reports
Required permissions
See note in the introduction for an explanation.
Example request
Config JSON Body Schema
Report Dashboard Schema
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 35
{
"id": 4,
"message": "Report created"
}
Status Codes
- 200 – OK
- 400 – Bad request (invalid json, missing or invalid fields values, etc.).
- 403 - Forbidden (access denied to a report or a dashboard used in the report).
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more details
Update a report
PUT /api/reports/:id
Required permissions
See note in the introduction for an explanation.
Example request
See JSON body schema for fields description.
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 28
{
"message": "Report updated"
}
Status Codes
- 200 – OK
- 400 – Bad request (invalid json, missing or invalid fields values, etc.).
- 401 - Authentication failed, refer to Authentication API.
- 403 – Forbidden (access denied to a report or a dashboard used in the report).
- 404 – Not found (such report does not exist).
- 500 – Unexpected error or server misconfiguration. Refer to server logs for more details.
Delete a report
DELETE /api/reports/:id
Required permissions
See note in the introduction for an explanation.
Example request
GET /api/reports/6 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 39
{
"message": "Report config was removed"
}
Status Codes
- 200 – OK
- 400 – Bad request (invalid report ID).
- 401 - Authentication failed, refer to Authentication API.
- 404 - Not found (report with this ID does not exist).
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more details
Send a report
POST /api/reports/email
Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds.
Required permissions
See note in the introduction for an explanation.
Example request
POST /api/reports/email HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"id":"3",
"useEmailsFromReport": true
}
JSON Body Schema
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 29
{"message":"Report was sent"}
Status Codes
- 200 – Report was sent.
- 400 – Bad request (invalid json, missing content-type, missing or invalid fields, etc.).
- 401 - Authentication failed, refer to Authentication API.
- 403 - Forbidden (access denied to a report or a dashboard used in the report).
- 404 - Report not found.
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more details.
Get reports branding settings
GET /api/reports/settings
Returns reports branding settings that are global and used across all the reports.
Required permissions
See note in the introduction for an explanation.
Example request
GET /api/reports/settings HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 181
{
"id": 1,
"userId": 1,
"orgId": 1,
"branding": {
"reportLogoUrl": "",
"emailLogoUrl": "",
"emailFooterMode": "sent-by",
"emailFooterText": "Grafana Labs",
"emailFooterLink": "https://grafana.com/"
}
}
Status Codes
- 200 – OK
- 401 - Authentication failed, refer to Authentication API.
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more detail
Save reports branding settings
POST /api/reports/settings
Creates settings if they don’t exist, otherwise updates them. These settings are global and used across all the reports.
Required permissions
See note in the introduction for an explanation.
Example request
POST /api/reports/settings HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"branding": {
"reportLogoUrl": "https://grafana.com/reportLogo.jpg",
"emailLogoUrl": "https://grafana.com/emailLogo.jpg",
"emailFooterMode": "sent-by",
"emailFooterText": "Grafana Labs",
"emailFooterLink": "https://grafana.com/"
}
}
JSON Body Schema
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 35
{
"message": "Report settings saved"
}
Status Codes
- 200 – OK
- 400 – Bad request (invalid json, missing or invalid fields values, etc.).
- 401 - Authentication failed, refer to Authentication API.
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more detail
Send a test email
POST /api/reports/test-email
Sends a test email with a report without persisting it in the database.
Required permissions
See note in the introduction for an explanation.
Example request
See JSON body schema for fields description.
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 29
{
"message": "Test email sent"
}
Status Codes
- 200 – OK
- 400 – Bad request (invalid json, missing or invalid fields values, etc.).
- 401 - Authentication failed, refer to Authentication API.
- 403 - Forbidden (access denied to a report or a dashboard used in the report).
- 500 - Unexpected error or server misconfiguration. Refer to server logs for more details