# Saved dashboards

> Every Ask answer is stored as a dashboard. Open it from its stored result, refresh it for free, and save it to keep it.

Source: https://openpipe.health/docs/api/saved/

Every completed answer from [Ask](https://openpipe.health/docs/api/ask.md) is stored as a dashboard in the workspace: first as a recent answer, and for good once a signed-in person saves it.

A dashboard stores its last result. Opening it returns that stored result without running anything. Refreshing it runs the statements the answer was planned with again and replaces the stored result.

None of the endpoints on this page spend credits. They act in one [workspace](https://openpipe.health/docs/workspaces.md), and an id that belongs to another workspace answers `404`, the same as an id that never existed.

## Who can do what

| | API key | Member | Owner or admin |
|---|---|---|---|
| List, open and refresh dashboards | Yes | Yes | Yes |
| [Export](https://openpipe.health/docs/api/exports.md#export-a-tile-of-an-answer) a tile (10 credits) | Yes | Yes | Yes |
| Save a dashboard | No | Yes | Yes |
| Rename or delete a recent (unsaved) dashboard | No | Yes | Yes |
| Rename, unsave or delete a saved dashboard | No | Only one they saved | Yes |

- "Member", "owner" and "admin" mean a signed-in person with a [session token](https://openpipe.health/docs/authentication.md#two-kinds-of-token). In your personal workspace you are the owner.
- Every response carries a `can` object (`save`, `modify`, `delete` on a dashboard; `delete` in lists) that says what this caller may do with it.

A refused call answers `403`. With an API key the message is `An API key can list, open and refresh saved answers. Sign in to save, rename or delete them.` For a member it is `Only the person who saved this, or a workspace owner or admin, can change or delete it.`

## Limits

| Limit | Value |
|---|---|
| Saved dashboards per workspace | 200 |
| Recent (unsaved) answers kept per workspace | The newest 50. Older ones are deleted. Saved dashboards are never deleted this way. |
| Name length | 120 characters |
| Refreshes | 20 per minute per workspace |
| Refreshes running at once | 2 per workspace |
| Stored result of a dashboard | 50 rows per `table` tile, 100 rows per tile of any other type, 8 tiles, 256 KB for all tiles together |

Old recent answers are removed when the dashboard list is requested, at most once a minute per workspace.

## Refreshing is free but rationed

A refresh runs the stored statements through the same [checks](https://openpipe.health/docs/receipts.md#how-model-written-sql-is-checked) they passed when the question was asked: the parse check, the read-only role, the time limit and a row cap. It costs nothing, so it has its own limits.

- **20 refreshes per minute per workspace.** Past that the response is `429` with `Retry-After` and `{ "error": "Too many refreshes. Try again in 41s.", "code": "RATE_LIMITED" }`.
- **2 refreshes at a time per workspace.** A third answers `429` with `Retry-After: 3` and:

```json
{ "error": "Other refreshes are still running in this workspace. Try again in a few seconds.", "code": "REFRESH_BUSY" }
```

- **The same dashboard refreshing twice at once is one run.** A second request for a dashboard that is already refreshing waits for that run and gets its result. It still counts toward the 20.

These limits apply on top of the [general rate limits](https://openpipe.health/docs/api/errors.md#rate-limits). On a successful refresh the `RateLimit-*` headers describe the workspace's general limit of 300; on a `429` from the refresh limit they describe the 20.

## Newer data available

Each stored result remembers when it was computed (`refreshedAt`) and which dataset versions it read (`dataVersion`). When a dataset that the dashboard reads has been loaded again since then, it is marked stale:

```json
"stale": true,
"staleDatasets": [{ "dataset": "hospitals", "version": "2027-01", "loadedAt": "2027-01-14T09:02:11.000Z" }]
```

- `staleDatasets` holds one entry per dataset loaded after `refreshedAt`. In list responses it is an array of dataset names only.
- A dashboard that has never been refreshed is not stale: it has no result to be out of date.
- Nothing refreshes on its own. `stale` is a prompt to call the refresh endpoint.
- Load times are re-read at most every 30 seconds, so the flag can lag a load by that long.

## List dashboards

```http
GET /api/dashboards
```

Returns the workspace's answers from [Ask](https://openpipe.health/docs/api/ask.md), saved or not, newest first.

| Parameter | Meaning |
|---|---|
| `saved` | `true` for saved dashboards only, ordered by when they were saved. `false` for recent answers only. Leave it out for both. |
| `q` | Text to find in the name, the generated title or the question. Case-insensitive, 100 characters at most. |
| `limit` | Default 20, maximum 100 |
| `offset` | Default 0, maximum 10,000 |

```sh
curl "$OPH_API/api/dashboards?saved=true&limit=2" \
  -H "Authorization: Bearer $OPH_KEY"
```

```json
{
  "rows": [
    {
      "id": "df706628-076f-4fa8-9797-c5f6028915ab",
      "question": "Largest hospitals in Vermont by beds",
      "createdAt": "2026-12-05T04:20:08.121Z",
      "title": "Largest hospitals in Vermont by beds",
      "saved": true,
      "savedAt": "2026-12-05T04:21:30.000Z",
      "savedBy": { "email": "you@example.com", "you": false, "label": "you@example.com" },
      "refreshedAt": "2026-12-05T04:22:43.437Z",
      "tiles": 1,
      "stale": false,
      "staleDatasets": [],
      "can": { "delete": false }
    }
  ],
  "more": false,
  "limit": 2,
  "offset": 0
}
```

- `more` is `true` when there are rows past this page.
- `tiles` is the number of tiles, not their contents.
- `savedBy` is `null` for a recent answer. `label` is `you` when a session token belongs to the person who saved it, otherwise their email, or `a teammate` when the email is not known.

## Open a dashboard

```http
GET /api/dashboards/:id
```

Returns the answer with its stored rows. Nothing runs.

```sh
curl "$OPH_API/api/dashboards/df706628-076f-4fa8-9797-c5f6028915ab" \
  -H "Authorization: Bearer $OPH_KEY"
```

```json
{
  "id": "df706628-076f-4fa8-9797-c5f6028915ab",
  "question": "Largest hospitals in Vermont by beds",
  "createdAt": "2026-12-05T04:20:08.121Z",
  "model": "claude-haiku-4-5",
  "title": "Largest hospitals in Vermont by beds",
  "name": null,
  "summary": "…",
  "followups": ["Which Vermont hospitals are critical access facilities?"],
  "tiles": [
    {
      "index": 0,
      "tile": { "type": "leaderboard", "title": "Largest Vermont hospitals", "sql": "SELECT ccn, name, city, state, beds … LIMIT 25", "x": "name", "y": "beds", "format": "number" },
      "columns": ["ccn", "name", "city", "state", "beds", "discharges", "net_patient_revenue"],
      "rows": [{ "ccn": "470005", "name": "RUTLAND REGIONAL MEDICAL CENTER", "city": "RUTLAND", "state": "VT", "beds": 134, "discharges": 5982, "net_patient_revenue": "331544608" }],
      "ms": 259,
      "sources": ["hospitals"],
      "engine": "postgres",
      "asOf": "2026-12-05T04:22:43.047Z"
    }
  ],
  "ms": 0,
  "credits": 0,
  "saved": false,
  "savedAt": null,
  "savedBy": null,
  "createdBy": null,
  "refreshedAt": "2026-12-05T04:22:43.047Z",
  "fromSnapshot": true,
  "stale": false,
  "staleDatasets": [],
  "dataVersion": { "hospitals": { "version": "enrollments 2026-11-12, cost report FY2024 final, owners 2026-11-12", "loadedAt": "2026-12-05T02:16:33.124Z" } },
  "can": { "save": false, "modify": false, "delete": false }
}
```

| Field | Meaning |
|---|---|
| `title` | The name if the dashboard was renamed, otherwise the generated title, otherwise the question |
| `name` | The name someone gave it, or `null` |
| `tiles` | Up to 8. Each has the tile as planned (`tile`, with its SQL as a [receipt](https://openpipe.health/docs/receipts.md)), the stored `columns` and `rows`, and `asOf`: when those rows were computed. A tile's place in this array is the `tile` index an [export](https://openpipe.health/docs/api/exports.md#export-a-tile-of-an-answer) takes. |
| `ms` | Always `0`: nothing ran |
| `fromSnapshot` | Always `true` |
| `createdBy` | Who asked, or `null` when the question was asked with an API key |
| `refreshedAt` | When the stored result was last replaced |

A tile without usable rows comes back as `{ "index", "tile", "sources", "error" }`:

| `error` | Why |
|---|---|
| `No result is stored for this tile yet. Refresh to load it.` | Nothing has been stored for it |
| `This result is too large to keep here. Export the tile as a CSV to get every row.` | The dashboard passed 256 KB and this tile's rows were dropped, largest tile first. [Export the tile](https://openpipe.health/docs/api/exports.md#export-a-tile-of-an-answer). |
| The statement's own error message | The tile has never run successfully. This includes a tile that failed when the question was asked: it is stored with its SQL so that a refresh can retry it. |

A tile whose last refresh failed but that has older rows keeps them, and adds `refreshError` and `refreshErrorAt`.

**An old answer can run once on first open.** An answer asked today is stored with the rows it was computed with. One stored before results were kept has none: the first `GET` of such an answer runs its tiles and stores the rows, under the same [refresh limits](#refreshing-is-free-but-rationed). If the workspace is over those limits at that moment, the answer still opens with status `200`, and each tile carries the "Refresh to load it" error.

Returns `404` with `No saved answer with that id.` if the id is unknown, is not a UUID, or belongs to another workspace.

## Refresh a dashboard

```http
POST /api/dashboards/:id/refresh
```

Runs every tile's stored SQL again, stores the capped result, and returns the dashboard in the same shape as [Open a dashboard](#open-a-dashboard) with one more field:

```sh
curl -X POST "$OPH_API/api/dashboards/df706628-076f-4fa8-9797-c5f6028915ab/refresh" \
  -H "Authorization: Bearer $OPH_KEY"
```

```json
"refresh": { "ok": 1, "failed": 0 }
```

- No model is called. The SQL is the SQL the answer was planned with; no endpoint accepts SQL, for a dashboard or anything else.
- A tile that failed when the question was asked is run again too, so a refresh is the free way to retry it.
- A tile that fails keeps the rows it had and records the error. The others are replaced.
- `refreshedAt` moves only if at least one tile ran. If every tile fails, the old time still describes the rows.
- `409` with `This answer has no tiles to refresh.` if the answer has no tiles.
- `404` if the dashboard was deleted while its tiles ran.

## Save, unsave or rename a dashboard

```http
PATCH /api/dashboards/:id
```

`POST` to the same path does the same. Needs a session token. See [who can do what](#who-can-do-what).

```json
{ "saved": true, "name": "Vermont hospitals by size" }
```

| Field | Meaning |
|---|---|
| `saved` | `true` saves the answer and records you as the person who saved it. `false` returns it to the recent answers. |
| `name` | A new name, 1 to 120 characters after trimming. Control characters are removed. |

Send one or both. Any other field (`sql`, `spec`, `tiles`, anything) is refused with `400`: a dashboard's statements cannot be changed. Returns the dashboard in the same shape as [Open a dashboard](#open-a-dashboard). Saving an answer that has no stored result runs its tiles once, as the first open does.

| Status | Message |
|---|---|
| `400` | `Body must be a JSON object.` |
| `400` | `Send "name", "saved" or both.` |
| `400` | `Only "name" and "saved" can be changed. Unknown field: "sql".` |
| `400` | `"saved" must be true or false.` |
| `400` | `Give it a name of at least one character.` |
| `403` | See [who can do what](#who-can-do-what) |
| `409` | `A workspace can keep 200 saved dashboards. Remove one first.` |

If two people save the same answer at once, one of them becomes `savedBy` and both calls succeed.

## Delete a dashboard

```http
DELETE /api/dashboards/:id
```

Needs a session token. Returns `{ "deleted": "<id>" }`, or `404`. A member's delete also answers `404` if someone else saved the answer in the moment before it.

## Things to know

- **A key that tries to change something it cannot see gets `404`, not `403`.** The id is looked up in the caller's workspace first.
- **Stored SQL is never trusted more than fresh SQL.** Every refresh and every tile export passes the same checks again, so a statement that was valid when the question was asked can fail later, for example after a table is renamed.
- **Saved queries are gone.** `/api/queries` and everything under it answer `404`. The API no longer accepts SQL, so there is nothing to save but answers.
- **Refresh limits are counted in memory, per server instance**, like the other [rate limits](https://openpipe.health/docs/api/errors.md#if-you-run-the-server).
