Skip to content

Reference

Saved prompts

The saved prompts endpoints of the HTTP API.

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
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
500 The server failed to handle the request. 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
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
409 The caller already has a prompt with that name, or shared is true and another shared prompt has it (name_taken). Error
413 The request body exceeds the size limit. 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
500 The server failed to handle the request. 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
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. 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
404 The caller cannot see the prompt (not_found); another person’s private prompt looks missing. 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
413 The request body exceeds the size limit. Error
422 The name is not valid (invalid_name) or the body is not valid (invalid_body). Error
500 The server failed to handle the request. 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
401 Authentication is missing or invalid. 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
404 The resource does not exist. Error
500 The server failed to handle the request. Error

Generated from api/openapi.yaml at bac0fe39. Report a problem.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. SlashObserve is not affiliated with or endorsed by Grafana Labs.

Search pages and headings.