---
title: "Saved prompts"
description: "The saved prompts 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.

# Saved prompts

## GET /prompts

List the saved prompts the caller may run.

Lists the prompts the caller may run: the caller's own prompts first, then prompts other people shared, each group by name ignoring case, at most 500. A service-account key sees shared prompts only. With `name`, returns at most one prompt matched ignoring case and with runs of spaces read as one: the caller's own prompt of that name, else the shared prompt of that name; an empty list when there is none.

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `name` | query | `string` |   |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The prompts the caller may run. | [`SavedPromptList`](/docs/reference/api/schemas/#savedpromptlist) |
| `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 /prompts

Save a prompt.

Saves a prompt owned by the caller. Service accounts cannot (403 `forbidden`), and neither can Commenters and Viewers (403 `forbidden_role`). At most 100 prompts per person.

### Request body

`application/json`, required.

| Field | Type | Description |
| --- | --- | --- |
| `name` (required) | `string` |   |
| `body` (required) | `string` |   |
| `shared` | `boolean` | Default `false`. |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `201` | The prompt is saved. | [`SavedPrompt`](/docs/reference/api/schemas/#savedprompt) |
| `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) |
| `409` | The caller already has a prompt with that name, or `shared` is true and another shared prompt has it (`name_taken`). | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#error) |
| `422` | The name is not valid (`invalid_name`), the body is not valid (`invalid_body`), or the caller already has 100 prompts (`too_many_prompts`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

## PATCH /prompts/{id}

Change a saved prompt.

Changes the name, body or sharing of a prompt the caller can edit: the owner, or an Admin when the prompt is shared. Only the fields sent change. Commenters and Viewers cannot change prompts, not even their own (403 `forbidden_role`).

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (required) | path | `string` (uuid) |   |

### Request body

`application/json`, required.

| Field | Type | Description |
| --- | --- | --- |
| `name` | `string` |   |
| `body` | `string` |   |
| `shared` | `boolean` |   |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | The prompt as changed. | [`SavedPrompt`](/docs/reference/api/schemas/#savedprompt) |
| `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 a service account (`forbidden`), has a role below Editor (`forbidden_role`), or can see the prompt but cannot edit it (`not_owner`). | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The caller cannot see the prompt (`not_found`); another person's private prompt looks missing. | [`Error`](/docs/reference/api/schemas/#error) |
| `409` | The new name is taken by another prompt of the owner, or by another shared prompt when the prompt is shared (`name_taken`). | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#error) |
| `422` | The name is not valid (`invalid_name`) or the body is not valid (`invalid_body`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

## DELETE /prompts/{id}

Delete a saved prompt.

Deletes a prompt the caller can edit: the owner, or an Admin when the prompt is shared. A service account gets 403 `forbidden`, a Commenter or Viewer 403 `forbidden_role`, a prompt the caller can see but not edit 403 `not_owner`, and a prompt the caller cannot see 404 `not_found`.

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (required) | path | `string` (uuid) |   |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `204` | The prompt is deleted. |   |
| `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 a service account (`forbidden`), has a role below Editor (`forbidden_role`), or can see the prompt but cannot edit it (`not_owner`). | [`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) |

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).
