Skip to main content

List Prompts

Sprint 3

List prompts with pagination and filtering.

Endpoint

GET /api/v1/prompts

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Query Parameters

ParameterTypeRequiredDescription
workspace_idintegerNoFilter by workspace
statusstringNoFilter by status
pageintegerNoPage number (default: 1, min: 1)
page_sizeintegerNoItems per page (default: 20, min: 1, max: 100)
searchstringNoSearch by name or prompt text
sort_bystringNoSort field (default: created_at)
sort_orderstringNoSort 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

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
500INTERNAL_SERVER_ERRORInternal 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>"