Reference
Grafana
The grafana endpoints of the HTTP API.
GET /grafana
List the stored Grafana connections.
Only Admins can call this endpoint. Connections are sorted by creation time; a response never carries the token.
Responses
| Status | Description | Body |
|---|---|---|
200 |
The connections. | GrafanaConnectionList |
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 |
500 |
The server failed to handle the request. | Error |
POST /grafana
Store a Grafana URL and service-account token.
Only Admins can call this endpoint. The URL may be http or https on any port, and its host may resolve to a private or loopback address, because Grafana usually runs inside the network. The host must be a domain name, and it is added to the outbound allowlist when it is not allowed yet. The token is encrypted with a key derived from SLASHOBSERVE_SECRET_KEY and is never returned.
Request body
application/json, required.
A CreateGrafanaConnectionRequest object.
Responses
| Status | Description | Body |
|---|---|---|
201 |
The connection is stored. | GrafanaConnection |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
403 |
The role is too low (forbidden_role), or SLASHOBSERVE_OUTBOUND_DOMAINS is set and does not allow the host (outbound_domain_not_allowed). |
Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing). |
Error |
413 |
The request body exceeds the size limit. | Error |
422 |
The host is not allowed and 100 outbound domains are already allowed (too_many_domains). |
Error |
500 |
The server failed to handle the request. | Error |
GET /grafana/{id}
Read one Grafana connection.
Only Admins can call this endpoint.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The connection. | GrafanaConnection |
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, or the caller cannot see it; the two are never told apart. | Error |
500 |
The server failed to handle the request. | Error |
PATCH /grafana/{id}
Change a connection’s name, URL or token.
Only Admins can call this endpoint. A new URL needs the token again, so a stored token never reaches another host. Changing the URL or the token clears the last test.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Request body
application/json, required.
A UpdateGrafanaConnectionRequest object.
Responses
| Status | Description | Body |
|---|---|---|
200 |
The changed connection. | GrafanaConnection |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
403 |
The role is too low (forbidden_role), or SLASHOBSERVE_OUTBOUND_DOMAINS is set and does not allow the new host (outbound_domain_not_allowed). |
Error |
404 |
The resource does not exist, or the caller cannot see it; the two are never told apart. | Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set and a new token was sent (secret_key_missing). |
Error |
413 |
The request body exceeds the size limit. | Error |
422 |
The new host is not allowed and 100 outbound domains are already allowed (too_many_domains). |
Error |
500 |
The server failed to handle the request. | Error |
DELETE /grafana/{id}
Delete a connection and its stored token.
Only Admins can call this endpoint. Imported dashboards stay. The host’s outbound allowlist entry, when the connection added it, is removed unless a webhook, a datasource or another connection still uses the host.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
204 |
The connection is deleted. | |
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, or the caller cannot see it; the two are never told apart. | Error |
500 |
The server failed to handle the request. | Error |
POST /grafana/{id}/test
Check that Grafana answers with the stored token.
Only Admins can call this endpoint. The server reads /api/health, /api/folders and the first page of /api/search, and stores the outcome in last_test. A Grafana that cannot be reached or refuses the token still answers 200, with last_test.ok false and a fixed message. Every test is recorded as grafana_connection.test with the host and the outcome.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The connection with its new last_test. |
GrafanaConnection |
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, or the caller cannot see it; the two are never told apart. | Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing), or the stored token cannot be read with it (token_unreadable). |
Error |
500 |
The server failed to handle the request. | Error |
GET /grafana/{id}/folders
List the Grafana folders and how many dashboards each holds.
Only Admins can call this endpoint. Nested folders are titled Parent / Child, and dashboards outside any folder are counted under the uid general. Counts cover the folder itself, not its subfolders.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The folders, sorted by title. | array of GrafanaFolder |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
403 |
The role is too low (forbidden_role), or the host is no longer on the outbound allowlist (outbound_domain_not_allowed). |
Error |
404 |
The resource does not exist, or the caller cannot see it; the two are never told apart. | Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing), or the stored token cannot be read with it (token_unreadable). |
Error |
500 |
The server failed to handle the request. | Error |
502 |
Grafana could not be reached, refused the token or gave an answer the server cannot read (grafana_unavailable); the message is fixed by the kind of failure. |
Error |
GET /grafana/{id}/datasources
List the Grafana datasources and the datasource each one matches here.
Only Admins can call this endpoint. matched_uid applies the importer’s automatic match rules; null means the datasource needs a mapping or has no supported type.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The datasources, sorted by name. | array of GrafanaDatasource |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
403 |
The role is too low (forbidden_role), or the host is no longer on the outbound allowlist (outbound_domain_not_allowed). |
Error |
404 |
The resource does not exist, or the caller cannot see it; the two are never told apart. | Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing), or the stored token cannot be read with it (token_unreadable). |
Error |
500 |
The server failed to handle the request. | Error |
502 |
Grafana could not be reached, refused the token or gave an answer the server cannot read (grafana_unavailable); the message is fixed by the kind of failure. |
Error |
POST /grafana/{id}/imports
Import every dashboard of the chosen folders.
Only Admins can call this endpoint. The import runs in the background; read its progress from the Location header. Each dashboard becomes one import record holding its Grafana uid, in a folder named after its Grafana folder (Parent / Child for nested ones), or General for dashboards outside any folder. A dashboard imported before is saved as a new version only when its Grafana version is newer, otherwise it is skipped. One dashboard failing never stops the run. A connection runs one import at a time. A server that stops hands the running import to another server, or picks it up again after its restart, skipping the dashboards it already handled. An import whose server crashes twice ends failed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
Request body
application/json, required.
A StartGrafanaImportRequest object.
Responses
| Status | Description | Body |
|---|---|---|
202 |
The import started. | GrafanaImport |
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, or the caller cannot see it; the two are never told apart. | Error |
409 |
An import from this connection is already running (import_running), SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing), or the stored token cannot be read with it (token_unreadable). |
Error |
413 |
The request body exceeds the size limit. | Error |
500 |
The server failed to handle the request. | Error |
GET /grafana/{id}/imports/{sync_id}
Read the progress of an import.
Only Admins can call this endpoint. Any server answers it, during the import and after it. Each connection keeps its last 20 imports; the connection’s last_sync is the newest finished one.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
|
sync_id (required) |
path | string |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The import and every dashboard handled so far. | GrafanaImport |
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, or the caller cannot see it; the two are never told apart. | Error |
500 |
The server failed to handle the request. | Error |
POST /grafana/{id}/imports/{sync_id}/cancel
Stop a running import.
Only Admins can call this endpoint. The import ends canceled at once; the dashboards it already imported stay, and one being saved at that moment may still be saved. Starting the import again skips what it already imported.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) |
path | string (uuid) |
|
sync_id (required) |
path | string |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The canceled import and every dashboard handled before it stopped. | GrafanaImport |
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, or the caller cannot see it; the two are never told apart. | Error |
409 |
The import is not running (invalid_transition). |
InvalidTransition |
500 |
The server failed to handle the request. | Error |
GET /grafana/resolve/{uid}
Find the dashboard imported from a Grafana uid.
Any signed-in caller can resolve a uid, so links to the old Grafana dashboard keep working. A uid whose dashboard sits in a folder the caller cannot see answers 404, like a uid nobody imported.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
uid (required) |
path | string |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The imported dashboard. | GrafanaResolved |
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, or the caller cannot see it; the two are never told apart. | Error |
500 |
The server failed to handle the request. | Error |
POST /grafana/link
Fetch a Grafana dashboard from its link through a stored connection.
Only Admins can call this endpoint, because the stored connection’s token is an Admin’s credential. The link must be a dashboard link (/d/<uid> or /d-solo/<uid>) on the address of a stored connection, under that address’s path; the server only fetches from hosts an Admin already stored. json is the dashboard as Grafana returns it, in a string that POST /imports takes as its json. Redirects are not followed. Every fetch is recorded as grafana_connection.fetch_dashboard, naming the connection and its host and never the link.
Request body
application/json, required.
A FetchGrafanaLinkRequest object.
Responses
| Status | Description | Body |
|---|---|---|
200 |
The dashboard. | GrafanaLinkedDashboard |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
403 |
The role is too low (forbidden_role), or SLASHOBSERVE_OUTBOUND_DOMAINS is set and does not allow the host (outbound_domain_not_allowed). |
Error |
404 |
No stored connection matches the link (no_connection), or Grafana has no dashboard with that uid that the connection’s token can read (dashboard_not_found). |
Error |
409 |
SLASHOBSERVE_SECRET_KEY is not set (secret_key_missing), or cannot read the stored token (token_unreadable). |
Error |
413 |
The request body exceeds the size limit. | Error |
422 |
The link is not a Grafana dashboard link (not_a_dashboard_link). |
Error |
500 |
The server failed to handle the request. | Error |
502 |
Grafana could not be reached, refused the token or gave an answer the server cannot read (grafana_unavailable); the message is fixed by the kind of failure. |
Error |
Generated from api/openapi.yaml at c770e5e0. Report a problem.