Policies
Attribute-based access control (ABAC) policies, password policies, and policy evaluation for fine-grained authorization.
/api/v1/organizations/:orgId/policiesCreate a policyBearer Token▾Creates a new ABAC policy for an organization. Requires SUPER_ADMIN or ORG_ADMIN role.
Parameters
Request Body
Response Fields
Response Example
{
"id": "pol_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"name": "Allow API read access",
"description": "Grants read-only access to all API resources.",
"type": "ACCESS",
"effect": "ALLOW",
"resource": "api:orders:*",
"actions": [
"read",
"list"
],
"rules": [],
"conditions": {
"ipRange": "10.0.0.0/8"
},
"priority": 10,
"enabled": true,
"createdAt": "2024-06-15T10:00:00Z",
"updatedAt": "2024-06-15T10:00:00Z"
}Code Examples
/api/v1/organizations/:orgId/policiesList policiesBearer Token▾Returns all policies for an organization, ordered by priority (descending) then creation date. Optionally filter by policy type. Requires SUPER_ADMIN, ORG_ADMIN, or READ_ONLY_ADMIN role.
Parameters
Response Fields
Response Example
{
"data": [
{
"id": "pol_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"name": "Allow API read access",
"description": "Grants read-only access to all API resources.",
"type": "ACCESS",
"effect": "ALLOW",
"resource": "api:orders:*",
"actions": [
"read",
"list"
],
"rules": [],
"conditions": {
"ipRange": "10.0.0.0/8"
},
"priority": 10,
"enabled": true,
"createdAt": "2024-06-15T10:00:00Z",
"updatedAt": "2024-06-15T10:00:00Z"
},
{
"id": "pol_02jy0a2r3x4f5s6u7v8w",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"name": "Default Sign-on Policy",
"description": "Default authentication rules for all users",
"type": "SIGN_ON",
"effect": "ALLOW",
"resource": "auth:login",
"actions": [
"login"
],
"rules": [
{
"id": "default_rule",
"name": "Catch-all",
"conditions": {
"group": "Everyone"
},
"requirement": "MFA_OPTIONAL",
"priority": 999
}
],
"conditions": {},
"priority": 0,
"enabled": true,
"createdAt": "2024-06-10T08:00:00Z",
"updatedAt": "2024-06-10T08:00:00Z"
}
]
}Code Examples
/api/v1/organizations/:orgId/policies/:policyIdGet a policyBearer Token▾Retrieves a single policy by its ID. Requires SUPER_ADMIN, ORG_ADMIN, or READ_ONLY_ADMIN role.
Parameters
Response Fields
Response Example
{
"id": "pol_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"name": "Allow API read access",
"description": "Grants read-only access to all API resources.",
"type": "ACCESS",
"effect": "ALLOW",
"resource": "api:orders:*",
"actions": [
"read",
"list"
],
"rules": [],
"conditions": {
"ipRange": "10.0.0.0/8"
},
"priority": 10,
"enabled": true,
"createdAt": "2024-06-15T10:00:00Z",
"updatedAt": "2024-06-15T10:00:00Z"
}Code Examples
/api/v1/organizations/:orgId/policies/:policyIdUpdate a policyBearer Token▾Updates an existing ABAC policy. All body fields are optional; only provided fields are changed. Requires SUPER_ADMIN or ORG_ADMIN role.
Parameters
Request Body
Response Fields
Response Example
{
"id": "pol_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"name": "Allow API full access",
"description": "Grants full access to all API resources.",
"type": "ACCESS",
"effect": "ALLOW",
"resource": "api:*",
"actions": [
"read",
"write",
"delete"
],
"rules": [],
"conditions": {
"ipRange": "192.168.0.0/16"
},
"priority": 20,
"enabled": true,
"createdAt": "2024-06-15T10:00:00Z",
"updatedAt": "2024-06-15T14:30:00Z"
}Code Examples
/api/v1/organizations/:orgId/policies/:policyIdDelete a policyBearer Token▾Permanently deletes a policy. This action cannot be undone. Requires SUPER_ADMIN or ORG_ADMIN role.
Parameters
Response Fields
Response Example
{
"message": "Policy deleted successfully"
}Code Examples
/api/v1/organizations/:orgId/policies/passwordGet password policyBearer Token▾Retrieves the password complexity and lockout policy for an organization. A default policy is auto-created if none exists. Requires SUPER_ADMIN, ORG_ADMIN, or READ_ONLY_ADMIN role.
Parameters
Response Fields
Response Example
{
"id": "pwp_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"minLength": 12,
"requireUppercase": true,
"requireLowercase": true,
"requireNumbers": true,
"requireSymbols": true,
"maxAgeDays": 0,
"historyCount": 5,
"lockoutThreshold": 5,
"lockoutDuration": 30,
"createdAt": "2024-06-01T08:00:00Z",
"updatedAt": "2024-06-01T08:00:00Z"
}Code Examples
/api/v1/organizations/:orgId/policies/passwordUpdate password policyBearer Token▾Updates the password complexity and lockout policy for an organization. All body fields are optional. Requires SUPER_ADMIN or ORG_ADMIN role.
Parameters
Request Body
Response Fields
Response Example
{
"id": "pwp_01hx9z1q2w3e4r5t6y7u",
"organizationId": "org_01hx9z1q2w3e4r5t6y7u",
"minLength": 14,
"requireUppercase": true,
"requireLowercase": true,
"requireNumbers": true,
"requireSymbols": true,
"maxAgeDays": 0,
"historyCount": 5,
"lockoutThreshold": 3,
"lockoutDuration": 60,
"createdAt": "2024-06-01T08:00:00Z",
"updatedAt": "2024-06-20T11:45:00Z"
}Code Examples
/api/v1/organizations/:orgId/policies/evaluateEvaluate policiesBearer Token▾Tests policy evaluation for a given resource, action, and context. Uses deny-override strategy: if any DENY policy matches, the result is DENY. Returns the decision, the matched policy, and the reason. Requires SUPER_ADMIN or ORG_ADMIN role.
Parameters
Request Body
Response Fields
Response Example
{
"decision": "ALLOW",
"matchedPolicy": {
"id": "pol_01hx9z1q2w3e4r5t6y7u",
"name": "Allow API read access",
"effect": "ALLOW",
"priority": 10
},
"reason": "Allowed by policy: Allow API read access"
}