Prompts

Prompts API

Create, read, update, and render versioned prompt templates.

POST
/api/prompts

Create a new prompt template.

jsonRequest Body
{
  "namespace": "support",
  "slug": "ticket-classifier",
  "content": "Classify this ticket: {{ticket_text}}\nCategories: {{categories}}"
}

Returns the created prompt with version: 1.

GET
/api/prompts

List all prompts. Filter by namespace with ?namespace=.

GET
/api/prompts/:namespace/:slug

Get a specific prompt. Pass ?version=N for a specific version.

PUT
/api/prompts/:namespace/:slug

Update a prompt. Creates a new version; previous versions are preserved.

jsonRequest Body
{
  "content": "Updated template: {{ticket_text}}"
}
GET
/api/prompts/:namespace/:slug/versions

List all versions of a prompt.

POST
/api/prompts/:namespace/:slug/render

Render a prompt template with variables.

jsonRequest Body
{
  "variables": {
    "ticket_text": "I can't access my account",
    "categories": "billing, technical, account"
  }
}
jsonResponse
{
  "rendered": "Classify this ticket: I can't access my account\nCategories: billing, technical, account"
}