List Prompts
Sprint 3
List prompts with pagination and filtering.
Endpoint
GET /api/v1/prompts
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 |
page | integer | No | Page number (default: 1, min: 1) |
page_size | integer | No | Items per page (default: 20, min: 1, max: 100) |
search | string | No | Search by name or prompt text |
sort_by | string | No | Sort field (default: created_at) |
sort_order | string | No | Sort order (asc/desc) (default: desc) |
Response
Success (200)
{
"success": true,
"data": {
"items": [
{
"id": 1,
"organization_id": 1,
"workspace_id": 1,
"name": "Sales Report",
"prompt_text": "Show me total sales by region",
"selected_data_source_ids": [1, 2],
"selected_schema_names": ["public"],
"generated_query_id": 10,
"status": "completed",
"tags": ["sales", "report"],
"created_by_user_id": 5,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total_items": 50,
"total_pages": 3
}
},
"message": "Prompts retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 500 | INTERNAL_SERVER_ERROR | Internal server error |
Features
- Pagination support
- Filtering by workspace and status
- Search by name or prompt text
- Sorting options
- Organization-scoped
Example
curl -X GET "https://api.rivergen.com/api/v1/prompts?workspace_id=1&status=completed&page=1&page_size=20" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Prompt - Get single prompt details
- Execute Prompt - Execute new prompt