Simulate policy evaluation.
curl --request POST \ --url https://auth.example.com/api/admin/policies/simulate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "context": { "subject": { "id": "user_123", "roles": [ "viewer" ] }, "resource": { "type": "user", "id": "user_456" }, "action": "read" }, "save_history": true }'Evaluate enabled policy rules against a supplied context as the Check API would, and optionally persist the simulation history for later review. The tenant’s settings apply (no grant while feature.enable_abac or feature.enable_custom_rules is off; no verified attributes while feature.enable_verified_attributes is off), as do the rules’ resource types and actions, and the subject’s scoped roles count only for the context’s resource and organization. While a rule cannot be evaluated as stored, nothing is granted and its id is returned. context.resource.type and context.action.name are required. Answers 503 when the settings cannot be read.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
object
The subject: id, roles ({ name, scope: global | org | resource, scopeTarget such as org:
object
object
object
When the request is evaluated, in UNIX milliseconds (default now).
object
Example
{ "context": { "subject": { "id": "user_123", "roles": [ "viewer" ] }, "resource": { "type": "user", "id": "user_456" }, "action": "read" }, "save_history": true}Responses
Section titled “ Responses ”Policy simulation response.
object
Example
{ "allowed": true, "reason": "Matched allow rule", "decided_by": "policy_123", "details": { "matched_rule": "policy_123" }, "evaluated_rules": 3}Error response.
object
Example generated
{ "error": "example", "message": "example", "error_description": "example"}Error response.
object
Example generated
{ "error": "example", "message": "example", "error_description": "example"}Error response.
object
Example generated
{ "error": "example", "message": "example", "error_description": "example"}Error response.
object
Example generated
{ "error": "example", "message": "example", "error_description": "example"}Error response.
object
Example generated
{ "error": "example", "message": "example", "error_description": "example"}