Skip to content

Reference

Grafana imports

The grafana imports endpoints of the HTTP API.

GET /dashboards/{id}/import

Get how a dashboard was imported from Grafana.

Answers 404 not_found when there is no such dashboard and 404 not_imported when the dashboard was not made by an import. Answers 403 forbidden_role when the caller cannot see the dashboard’s folder.

Parameters

Name In Type Description
id (required) path string (uuid)

Responses

Status Description Body
200 The import record, with the report as verified when the dashboard was saved. ImportRecord
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller is not allowed to perform the request; a role that is too low is code forbidden_role. Error
404 The resource does not exist. Error
500 The server failed to handle the request. Error

POST /imports/preview

Convert a Grafana dashboard without saving it or running any query.

Accepts the classic dashboard model, the export wrapper (with __inputs) and the API response {"dashboard": ..., "meta": ...} as the text in json. ready is false while a source datasource has no match; spec is then null. report.verified is always false because no query runs. A body above 8 MiB answers 413 too_large. A caller has at most 2 previews in flight and the instance at most 4; more answers 429 too_many_imports. A 422 carries the importer’s code: invalid_json, not_a_dashboard, unsupported_format, too_many_panels or invalid_mapping. Answers 403 forbidden_role when the caller cannot create dashboards in any folder.

Request body

application/json, required.

A ImportRequest object.

Responses

Status Description Body
200 The converted dashboard, its datasource matches and the import report. ImportPreview
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller is not allowed to perform the request; a role that is too low is code forbidden_role. Error
413 The request body exceeds the size limit. Error
422 The JSON is not a Grafana dashboard the importer accepts (invalid_json, not_a_dashboard, unsupported_format, too_many_panels) or the mapping is wrong (invalid_mapping). Error
429 The caller already has 2 previews in flight, or the instance has 4 (too_many_imports). Error
500 The server failed to handle the request. Error

GET /imports

List imports, newest first.

Only imports of dashboards in folders the caller can see.

Parameters

Name In Type Description
limit query integer Between 1 and 200. Default 50.
cursor query string
made_by query string Only imports made by the caller; the only value is me.
dashboard_id query string Only the import of this dashboard; zero or one item.

Responses

Status Description Body
200 One page of imports. ImportList
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
500 The server failed to handle the request. Error

POST /imports

Import a Grafana dashboard as version 1 of a new dashboard.

Takes the same body as the preview and saves the converted Spec even when some queries fail. Panels whose queries fail are marked unverified in the stored report with the reason; later saves of the dashboard run every query as usual. The original JSON is stored for a later re-import and is never returned. A caller has at most 1 import in flight and the instance at most 4; more answers 429 too_many_imports. A retried agent request that already made its dashboard without an import answers 200 with that dashboard and no import. The folder is folder from the body, else the Grafana export’s meta.folderTitle, else the caller’s default folder (the last folder they created in, or General); General means the default. A folder that does not exist is created when the caller is an Editor or above and the caller becomes its creator. Otherwise, or when the folder exists but the caller cannot see it or create in it, the dashboard goes to the default folder and folder_note says so. Answers 403 forbidden_role when the caller cannot create dashboards in any folder, and 404 not_found when a folder disappears while the dashboard is saved.

Request body

application/json, required.

A ImportRequest object.

Responses

Status Description Body
200 The dashboard the request already created, when no import made it. DashboardWithVersion
201 The new dashboard, its first version and the import record. ImportedDashboard
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller is not allowed to perform the request; a role that is too low is code forbidden_role. Error
404 The resource does not exist. Error
413 The request body exceeds the size limit. Error
422 The importer’s codes as for the preview (invalid_json, not_a_dashboard, unsupported_format, too_many_panels, invalid_mapping), datasources_unresolved while a source datasource has no match (datasources lists every one, candidates the choices), or invalid_spec when the converted Spec cannot be saved (for example a NUL character; issues lists the problems). Error or DatasourcesUnresolved or ValidationError
429 The caller already has an import in flight, or the instance has 4 (too_many_imports). Error
500 The server failed to handle the request. Error

Generated from api/openapi.yaml at bac0fe39. Report a problem.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. SlashObserve is not affiliated with or endorsed by Grafana Labs.

Search pages and headings.