---
title: "Grafana imports"
description: "The grafana imports endpoints of the HTTP API."
---

> Documentation Index
> Fetch the complete documentation index at: https://slashobserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grafana imports

## 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`](/docs/reference/api/schemas/#importrecord) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller is not allowed to perform the request; a role that is too low is code `forbidden_role`. | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The resource does not exist. | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#importrequest) object.

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The converted dashboard, its datasource matches and the import report. | [`ImportPreview`](/docs/reference/api/schemas/#importpreview) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller is not allowed to perform the request; a role that is too low is code `forbidden_role`. | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#error) |
| `429` | The caller already has 2 previews in flight, or the instance has 4 (`too_many_imports`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#importlist) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#importrequest) object.

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The dashboard the request already created, when no import made it. | [`DashboardWithVersion`](/docs/reference/api/schemas/#dashboardwithversion) |
| `201` | The new dashboard, its first version and the import record. | [`ImportedDashboard`](/docs/reference/api/schemas/#importeddashboard) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller is not allowed to perform the request; a role that is too low is code `forbidden_role`. | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The resource does not exist. | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#error) or [`DatasourcesUnresolved`](/docs/reference/api/schemas/#datasourcesunresolved) or [`ValidationError`](/docs/reference/api/schemas/#validationerror) |
| `429` | The caller already has an import in flight, or the instance has 4 (`too_many_imports`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

Generated from [`api/openapi.yaml`](https://github.com/slashobserve/slashobserve/blob/bac0fe39/api/openapi.yaml) at `bac0fe39`. [Report a problem](https://github.com/slashobserve/slashobserve/issues/new).
