Skip to main content

Get Policy

Sprint 3

Get policy details by ID including rules and assignments.

Endpoint

GET /api/v1/policies/{policy_id}

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Path Parameters

ParameterTypeRequiredDescription
policy_idintegerYesPolicy ID

Response

Success (200)

{
"success": true,
"data": {
"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,
"rules": [
{
"id": 1,
"policy_id": 1,
"rule_name": "Region Filter Rule",
"rule_type": "filter_rows",
"rule_config": {
"condition": "user_region = current_user_region",
"table": "sales",
"column": "region"
},
"rule_order": 0,
"is_active": true,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T08:00:00Z"
}
],
"assignments": [
{
"id": 1,
"policy_id": 1,
"data_source_id": 1,
"role_id": 2,
"role_name": "Analyst",
"is_active": true,
"applied_at": "2024-12-01T09:00:00Z",
"applied_by_user_id": 1
}
],
"metadata": {},
"created_by_user_id": 1,
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z",
"updated_by_user_id": 1
},
"message": "Policy retrieved successfully"
}

Error Codes

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
404NOT_FOUNDPolicy not found

Features

  • Returns complete policy configuration
  • Includes all rules with configurations
  • Includes all assignments
  • Organization-scoped access control

Example

curl -X GET "https://api.rivergen.com/api/v1/policies/1" \
-H "Authorization: Bearer <access_token>"