Skip to main content
The Prompts API lets you store, version, and manage prompt templates centrally. Every template change creates an immutable version, giving you a full change history with the ability to roll back to any previous version at any time. Templates support {{variable}} placeholders that are rendered server-side when you retrieve a prompt, so you can reuse the same template across different contexts.

Create a prompt

Create a prompt with a name and template. The first version is created automatically.

Retrieve a prompt with rendered variables

Pass variables as a query parameter to render the template with your values. Unmatched placeholders are left as-is. Optionally, pass version to retrieve (and render) a specific version. If omitted, the active version is returned.
The response always includes active_template (activeTemplate in the TypeScript SDK) — the raw template text of the requested version, with {{placeholders}} intact. When you pass variables, the response also includes rendered_template (renderedTemplate) with the substituted result; it is absent when no variables are provided.

List prompts

Retrieve a paginated list of all prompts. Use after for cursor-based pagination.

Update prompt metadata

Update the name, description, or metadata of a prompt. To change the template, create a new version instead. Note: metadata replaces the existing metadata object (it is not merged). To clear a description, pass null.

Create a new version

Each template change creates a new version. The new version automatically becomes the active version.

View version history

List all versions of a prompt to see its full change history.

Retrieve a specific version

Fetch a single version by its version number.

Roll back to a previous version

Rollback sets an earlier version as the active version. All versions are preserved — rollback does not delete newer versions, so you can always roll forward again.

Delete a prompt

Deleting a prompt removes it and all of its versions permanently.

Full example: versioning and rollback workflow

This example demonstrates the complete lifecycle — creating a prompt, iterating on the template, reviewing history, and rolling back.

Behavior details

Next steps