Dashboard API

    The unique identifier (uid) of a dashboard can be used for uniquely identify a dashboard between multiple Grafana installs. It’s automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs, see for more information. This means that changing the title of a dashboard will not break any bookmarked links to that dashboard.

    The uid can have a maximum length of 40 characters.

    Create / Update dashboard

    Creates a new dashboard or updates an existing dashboard. When updating existing dashboards, if you do not define the folderId or the folderUid property, then the dashboard(s) are moved to the General folder. (You need to define only one property, not both).

    Example Request for new dashboard:

    JSON Body schema:

    • dashboard – The complete dashboard model, id = null to create a new dashboard.
    • dashboard.id – id = null to create a new dashboard.
    • dashboard.uid – Optional unique identifier when creating a dashboard. uid = null will generate a new uid.
    • folderId – The id of the folder to save the dashboard in.
    • folderUid – The UID of the folder to save the dashboard in. Overrides the folderId.
    • overwrite – Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    • message - Set a commit message for the version history.
    • refresh - Set the dashboard refresh interval. If this is lower than , then Grafana will ignore it and will enforce the minimum refresh interval.

    For adding or updating an alert rule for a dashboard panel the user should declare a dashboard.panels.alert block.

    Example Request for updating dashboard alert rule:

    1. HTTP/1.1 200 OK
    2. Content-Type: application/json; charset=UTF-8
    3. Content-Length: 78
    4. {
    5. "dashboard": {
    6. "id": 104,
    7. "panels": [
    8. {
    9. "alert": {
    10. "alertRuleTags": {},
    11. "conditions": [
    12. {
    13. "evaluator": {
    14. "params": [
    15. 25
    16. ],
    17. "type": "gt"
    18. },
    19. "operator": {
    20. "type": "and"
    21. },
    22. "query": {
    23. "params": [
    24. "A",
    25. "5m",
    26. "now"
    27. ]
    28. },
    29. "reducer": {
    30. "params": [],
    31. "type": "avg"
    32. },
    33. "type": "query"
    34. }
    35. ],
    36. "executionErrorState": "alerting",
    37. "for": "5m",
    38. "frequency": "1m",
    39. "handler": 1,
    40. "name": "Panel Title alert",
    41. "noDataState": "no_data",
    42. "notifications": []
    43. },
    44. "aliasColors": {},
    45. "bars": false,
    46. "dashLength": 10,
    47. "dashes": false,
    48. "datasource": null,
    49. "fieldConfig": {
    50. "defaults": {
    51. "custom": {}
    52. },
    53. "overrides": []
    54. },
    55. "fill": 1,
    56. "fillGradient": 0,
    57. "gridPos": {
    58. "h": 9,
    59. "w": 12,
    60. "x": 0,
    61. "y": 0
    62. },
    63. "hiddenSeries": false,
    64. "id": 2,
    65. "legend": {
    66. "avg": false,
    67. "current": false,
    68. "max": false,
    69. "min": false,
    70. "show": true,
    71. "total": false,
    72. "values": false
    73. },
    74. "lines": true,
    75. "linewidth": 1,
    76. "nullPointMode": "null",
    77. "options": {
    78. "dataLinks": []
    79. "percentage": false,
    80. "pointradius": 2,
    81. "points": false,
    82. "renderer": "flot",
    83. "seriesOverrides": [],
    84. "stack": false,
    85. "steppedLine": false,
    86. "targets": [
    87. {
    88. "refId": "A",
    89. "scenarioId": "random_walk"
    90. }
    91. ],
    92. "thresholds": [
    93. {
    94. "colorMode": "critical",
    95. "fill": true,
    96. "line": true,
    97. "op": "gt",
    98. "value": 50
    99. }
    100. ],
    101. "timeFrom": null,
    102. "timeRegions": [],
    103. "timeShift": null,
    104. "title": "Panel Title",
    105. "tooltip": {
    106. "shared": true,
    107. "sort": 0,
    108. "value_type": "individual"
    109. },
    110. "type": "graph",
    111. "xaxis": {
    112. "buckets": null,
    113. "mode": "time",
    114. "name": null,
    115. "show": true,
    116. "values": []
    117. },
    118. "yaxes": [
    119. {
    120. "format": "short",
    121. "label": null,
    122. "logBase": 1,
    123. "max": null,
    124. "min": null,
    125. "show": true
    126. },
    127. {
    128. "format": "short",
    129. "label": null,
    130. "logBase": 1,
    131. "max": null,
    132. "min": null,
    133. "show": true
    134. }
    135. ],
    136. "yaxis": {
    137. "align": false,
    138. "alignLevel": null
    139. }
    140. }
    141. ],
    142. "title": "Update alert rule via API",
    143. "uid": "dHEquNzGz",
    144. "version": 1
    145. }
    146. }

    Example Response:

    1. HTTP/1.1 200 OK
    2. Content-Type: application/json; charset=UTF-8
    3. Content-Length: 78
    4. {
    5. "id": 1,
    6. "uid": "cIBgcSjkk",
    7. "url": "/d/cIBgcSjkk/production-overview",
    8. "status": "success",
    9. "version": 1,
    10. "slug": "production-overview" //deprecated in Grafana v5.0
    11. }

    Status Codes:

    • 200 – Created
    • 400 – Errors (invalid json, missing or invalid fields, etc)
    • 401 – Unauthorized
    • 403 – Access denied
    • 412 – Precondition failed
    • The dashboard has been changed by someone else, status=version-mismatch
    • A dashboard with the same name in the folder already exists, status=name-exists
    • A dashboard with the same uid already exists, status=name-exists
    • The dashboard belongs to plugin <plugin title>, status=plugin-dashboard

    The response body will have the following properties:

    1. HTTP/1.1 412 Precondition Failed
    2. Content-Type: application/json; charset=UTF-8
    3. Content-Length: 97
    4. "message": "The dashboard has been changed by someone else",
    5. "status": "version-mismatch"
    6. }

    In case of title already exists the status property will be .

    GET /api/dashboards/uid/:uid

    Will return the dashboard given the dashboard unique identifier (uid). Information about the unique identifier of a folder containing the requested dashboard might be found in the metadata.

    Example Request:

    Example Response:

    1. HTTP/1.1 200
    2. Content-Type: application/json
    3. {
    4. "dashboard": {
    5. "id": 1,
    6. "uid": "cIBgcSjkk",
    7. "title": "Production Overview",
    8. "tags": [ "templated" ],
    9. "timezone": "browser",
    10. "schemaVersion": 16,
    11. "version": 0
    12. },
    13. "meta": {
    14. "isStarred": false,
    15. "url": "/d/cIBgcSjkk/production-overview",
    16. "folderId": 2,
    17. "folderUid": "l3KqBxCMz",
    18. "slug": "production-overview" //deprecated in Grafana v5.0
    19. }
    20. }

    Status Codes:

    • 200 – Found
    • 401 – Unauthorized
    • 403 – Access denied
    • 404 – Not found

    Delete dashboard by uid

    DELETE /api/dashboards/uid/:uid

    Will delete the dashboard given the specified unique identifier (uid).

    Example Request:

    1. DELETE /api/dashboards/uid/cIBgcSjkk HTTP/1.1
    2. Accept: application/json
    3. Content-Type: application/json
    4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
    1. HTTP/1.1 200
    2. Content-Type: application/json
    3. {
    4. "title": "Production Overview",
    5. "message": "Dashboard Production Overview deleted",
    6. "id": 2
    7. }

    Status Codes:

    • 200 – Deleted
    • 401 – Unauthorized
    • 403 – Access denied
    • 404 – Not found

    GET /api/dashboards/home

    Will return the home dashboard.

    Example Request:

    Example Response:

    1. HTTP/1.1 200
    2. Content-Type: application/json
    3. {
    4. "dashboard": {
    5. "editable":false,
    6. "hideControls":true,
    7. "nav":[
    8. {
    9. "enable":false,
    10. "type":"timepicker"
    11. }
    12. ],
    13. "style":"dark",
    14. "tags":[],
    15. "templating":{
    16. "list":[
    17. ]
    18. },
    19. "time":{
    20. },
    21. "timezone":"browser",
    22. "title":"Home",
    23. "version":5
    24. },
    25. "meta": {
    26. "isHome":true,
    27. "canSave":false,
    28. "canEdit":false,
    29. "canStar":false,
    30. "url":"",
    31. "expires":"0001-01-01T00:00:00Z",
    32. "created":"0001-01-01T00:00:00Z"
    33. }
    34. }

    Tags for Dashboard

    GET /api/dashboards/tags

    Get all tags of dashboards

    Example Request:

    1. GET /api/dashboards/tags HTTP/1.1
    2. Accept: application/json
    3. Content-Type: application/json
    4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

    Example Response:

    1. HTTP/1.1 200
    2. Content-Type: application/json
    3. [
    4. {
    5. "term":"tag1",
    6. "count":1
    7. },
    8. {
    9. "term":"tag2",
    10. "count":4
    11. ]

    See .