List Prompt Templates
Sprint 3
List prompt templates with filtering options.
Endpoint
GET /api/v1/prompt-templates
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | integer | No | Filter by organization (defaults to current user's organization) |
category | string | No | Filter by category |
is_system_template | boolean | No | Filter system templates |
is_public | boolean | No | Filter public templates |
search | string | No | Search by name or description |
Response
Success (200)
{
"success": true,
"data": {
"items": [
{
"id": 1,
"organization_id": 1,
"name": "Sales Report Template",
"description": "Template for generating sales reports",
"template_text": "Show me {{metric}} for {{time_period}}",
"parameters": [
{
"name": "metric",
"type": "string",
"required": true,
"description": "Metric to report on"
},
{
"name": "time_period",
"type": "string",
"required": true,
"default": "last_30_days"
}
],
"category": "reports",
"tags": ["sales", "report"],
"icon_url": "https://example.com/icon.png",
"icon_presigned_url": "https://storage.example.com/...",
"status": "published",
"compatible_data_source_ids": [1, 2],
"is_system_template": false,
"is_public": true,
"usage_count": 25,
"created_by_user_id": 1,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
]
},
"message": "Prompt templates retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 500 | INTERNAL_SERVER_ERROR | Internal server error |
Features
- Filter by organization, category, system/public status
- Search by name or description
- Returns template parameters
- Shows usage count
- Organization-scoped
Example
curl -X GET "https://api.rivergen.com/api/v1/prompt-templates?category=reports&is_public=true" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Template - Get template details
- Execute Template - Execute template