Get Prompt History
Sprint 3
Get prompt history - one row per prompt with latest execution information.
Endpoint
GET /api/v1/prompts/history
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_id | integer | No | Filter by workspace |
status | string | No | Filter by status (completed, failed, processing, draft) |
data_source_id | integer | No | Filter by data source ID |
time_period | string | No | Filter by time period (last_7_days, last_30_days, last_90_days, all) |
search | string | No | Search by prompt name or text |
page | integer | No | Page number (default: 1, min: 1) |
page_size | integer | No | Items per page (default: 20, min: 1, max: 100) |
sort_by | string | No | Sort field (timestamp, status, execution_time) (default: timestamp) |
sort_order | string | No | Sort order (asc/desc) (default: desc) |
user_id | integer | No | Filter by user ID (defaults to current user) |
Response
Success (200)
{
"success": true,
"data": {
"items": [
{
"id": 1,
"name": "Sales Report",
"prompt_text": "Show me total sales by region",
"status": "completed",
"execution_time_ms": 1250,
"timestamp": "2024-12-01T10:00:00Z",
"data_source_ids": [1, 2],
"user_id": 5,
"workspace_id": 1
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total_items": 50,
"total_pages": 3
}
},
"message": "Prompt history retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 500 | INTERNAL_SERVER_ERROR | Internal server error |
Features
- One row per prompt with latest execution info
- Extensive filtering options
- Search by name or text
- Multiple sort options
- Pagination support
- Organization-scoped
Example
curl -X GET "https://api.rivergen.com/api/v1/prompts/history?time_period=last_7_days&status=completed&page=1&page_size=20" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- List Prompts - List all prompts
- Clear History - Clear prompt history