---
title: "Provision"
description: "The provision 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.

# Provision

## GET /provision

Show what the provisioning directory became.

Lists every file that became a dashboard and every file that never did, each sorted by `path` in byte order. Paths are relative to `SLASHOBSERVE_PROVISION_DIR`, with `/` between directories. The lists are kept when provisioning is turned off, so they can still be read; `dir` is then null. Only Admins may call this endpoint.

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The provisioning status. | [`ProvisionStatus`](/docs/reference/api/schemas/#provisionstatus) |
| `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) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

## POST /provision/run

Provision the directory now.

Reads every file of the directory once, as the server does at startup and when a file changes, and answers the status afterwards. An unchanged file saves nothing, and a changed file adds one version. Only Admins may call this endpoint.

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The provisioning status after the run. | [`ProvisionStatus`](/docs/reference/api/schemas/#provisionstatus) |
| `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) |
| `409` | Provisioning is off because `SLASHOBSERVE_PROVISION_DIR` is not set (`provisioning_off`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The directory cannot be read (`provision_dir_unreadable`), or the server failed (`internal`). | [`Error`](/docs/reference/api/schemas/#error) |

## POST /provision/apply

Save one dashboard file from a dashboards-as-code directory.

Editors and Admins can call this endpoint; `observe dashboards apply` calls it once per file. `path` is the file's path relative to the applied directory, with `/` between directories: a file name, or a folder directory and a file name. The directory names the folder, with `%` written as `%25` and `/` as `%2F`, and a file at the root goes to General. A path that was applied before saves into the same dashboard. Otherwise the one dashboard in that folder whose title matches the Spec's title, compared case-insensitively, is adopted, and the path is bound to it; when no dashboard matches a new one is created, with the folder when it does not exist yet. A version is saved as the caller, with the summary `Applied from <path>`, only when the file changed since it was last applied and differs from the latest version. Apply never deletes a dashboard. It answers 409 `ambiguous` when more than one dashboard in the folder has the title, 409 `provisioned` when the dashboard comes from the server's provisioning directory, 409 `folder_exists` when the file's folder exists but the caller cannot see it (the same answer as creating a folder with that name), 409 `version_conflict` when another save landed during the apply, and 409 `restricted_content` when the dashboard reads a datasource only Admins can query and its folder is not one only Admins can read.

### Request body

`application/json`, required.

| Field | Type | Description |
| --- | --- | --- |
| `path` (required) | `string` |   |
| `spec` (required) | `object` | The ObserveSpec document of the file. |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | What the file became. | [`ApplyResult`](/docs/reference/api/schemas/#applyresult) |
| `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, or the caller cannot see it; the two are never told apart. | [`Error`](/docs/reference/api/schemas/#error) |
| `409` | The request conflicts with existing state. | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#error) |
| `422` | The Spec fails validation or one of its queries fails; every problem is listed in `issues`. | [`ValidationError`](/docs/reference/api/schemas/#validationerror) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

## GET /provision/applied

List the file paths bound to the dashboards of a folder.

Anyone with a role can call this endpoint for a folder they can see; `observe dashboards export` reads it to keep the file names a folder was applied from. Each entry is a path that `POST /provision/apply` bound to a dashboard now in the folder, sorted by `path` in byte order.

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `folder_id` (required) | query | `string` (uuid) |   |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The bound paths. | [`AppliedList`](/docs/reference/api/schemas/#appliedlist) |
| `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, or the caller cannot see it; the two are never told apart. | [`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/c770e5e0/api/openapi.yaml) at `c770e5e0`. [Report a problem](https://github.com/slashobserve/slashobserve/issues/new).
