List Policies
Sprint 3
List policies with pagination and filtering.
Endpoint
GET /api/v1/policies
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_id | integer | No | Filter by workspace ID |
type | string | No | Filter by policy type |
is_active | boolean | No | Filter by active status |
page | integer | No | Page number (default: 1) |
page_size | integer | No | Items per page (default: 20) |
search | string | No | Search by name or description |
Response
Success (200)
{
"success": true,
"data": {
"items": [
{
"id": 1,
"organization_id": 1,
"workspace_id": 1,
"name": "RLS Policy - Region Filter",
"description": "Filter rows by user region",
"type": "row_level_security",
"is_active": true,
"priority": 10,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total_items": 15,
"total_pages": 1
}
},
"message": "Policies retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid request parameters |
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 500 | INTERNAL_SERVER_ERROR | Internal server error |
Features
- Pagination support
- Filtering by workspace, type, and active status
- Search by name or description
- Organization-scoped
Example
curl -X GET "https://api.rivergen.com/api/v1/policies?type=row_level_security&is_active=true&page=1&page_size=20" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Policy - Get single policy details
- Create Policy - Create new policy