Skip to main content

Get Policy Evaluations

Sprint 3

Get policy evaluation history (audit trail) for a policy.

Endpoint

GET /api/v1/policies/{policy_id}/evaluations

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Path Parameters

ParameterTypeRequiredDescription
policy_idintegerYesPolicy ID

Query Parameters

ParameterTypeRequiredDescription
user_idintegerNoFilter by user ID
query_idintegerNoFilter by query ID
start_datestringNoStart date (ISO 8601 format, e.g., "2024-12-01T00:00:00Z")
end_datestringNoEnd date (ISO 8601 format, e.g., "2024-12-31T23:59:59Z")
pageintegerNoPage number (default: 1)

Response

Success (200)

{
"success": true,
"data": {
"items": [
{
"id": 1,
"policy_id": 1,
"policy_rule_id": 1,
"user_id": 5,
"query_id": 10,
"data_source_id": 1,
"dataset_id": null,
"evaluation_result": "allowed",
"action_taken": "filtered_rows",
"evaluation_details": {
"rows_filtered": 50,
"rows_returned": 10
},
"evaluated_at": "2024-12-01T10:00:00Z",
"ip_address": "192.168.1.1",
"metadata": {}
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total_items": 150,
"total_pages": 8
}
},
"message": "Policy evaluations retrieved successfully"
}

Error Codes

StatusCodeDescription
400BAD_REQUESTInvalid date format (use ISO 8601)
401UNAUTHORIZEDInvalid or missing authentication token
404NOT_FOUNDPolicy not found
500INTERNAL_SERVER_ERRORInternal server error

Evaluation Results

  • allowed: Policy allowed the operation
  • denied: Policy denied the operation
  • modified: Policy modified the operation (e.g., filtered rows, masked data)

Features

  • Filter by user, query, and date range
  • Pagination support
  • Includes evaluation details and actions taken
  • IP address tracking
  • Organization-scoped access control

Date Format

Dates must be in ISO 8601 format:

  • 2024-12-01T00:00:00Z
  • 2024-12-01T00:00:00+00:00

Example

curl -X GET "https://api.rivergen.com/api/v1/policies/1/evaluations?start_date=2024-12-01T00:00:00Z&end_date=2024-12-31T23:59:59Z&page=1" \
-H "Authorization: Bearer <access_token>"