Get Prompt
Sprint 3
Get prompt details by ID.
Endpoint
GET /api/v1/prompts/{prompt_id}
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt_id | integer | Yes | Prompt ID |
Response
Success (200)
{
"success": true,
"data": {
"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,
"generated_query": {
"id": 10,
"query_text": "SELECT region, SUM(sales) FROM sales_data GROUP BY region"
},
"ai_model_used": "gpt-4",
"ai_request_id": "req_abc123",
"ai_response_metadata": {
"model": "gpt-4",
"confidence": 0.95,
"tokens_used": 150,
"explanation": "Generated SQL query for sales aggregation"
},
"status": "completed",
"error_message": null,
"tags": ["sales", "report"],
"metadata": {},
"created_by_user_id": 5,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
},
"message": "Prompt retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 404 | NOT_FOUND | Prompt not found |
Features
- Returns complete prompt configuration
- Includes generated query details
- Includes AI metadata
- Organization-scoped access control
Example
curl -X GET "https://api.rivergen.com/api/v1/prompts/1" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- List Prompts - List all prompts
- Get Execution History - Get execution history for this prompt