Create policy
const url = 'https://example.com/v1/policies';const options = { method: 'POST', headers: { 'X-Tenant-ID': '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0', 'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json' }, body: '{"name":"example","description":"example","enabled":true,"priority":0,"max_duration_seconds":1,"default_duration_seconds":1,"notification_channel":"example","cedar_policy_set":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/policies \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --header 'X-Tenant-ID: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --data '{ "name": "example", "description": "example", "enabled": true, "priority": 0, "max_duration_seconds": 1, "default_duration_seconds": 1, "notification_channel": "example", "cedar_policy_set": "example" }'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Tenant identifier. Must match the tenant associated with the credential. Returns 403 tenant_mismatch if the credential and header belong to different tenants.
Request Body required
Section titled “Request Body required ”Create a new policy.
object
Policy name (required).
Maximum grant duration in seconds (required).
Optional multi-statement Cedar text, parsed into rules.
Responses
Section titled “ Responses ”Created
Full policy with nested rules.
object
Policy name (required).
Optional description.
Whether the policy is active.
Higher values evaluated first.
Maximum allowed grant duration in seconds (required).
Default grant duration if not specified in request.
Optional notification channel for approvals.
Nested rules for this policy.
Single rule within a policy.
object
Evaluation order within the policy.
Assembled Cedar text for this rule.
Raw Cedar when/unless clause text.
User-facing message for this rule.
Whether grants should have session auditing.
Assembled Cedar policy text for all rules.
Example
{ "rules": [ { "effect": "permit", "principal_scope_type": "any", "action_scope_type": "any", "resource_scope_type": "any" } ]}Invalid input or Cedar policy.
object
Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).
Human-readable description of the error.
Optional additional context about the error.
object
Policy notices from determining Cedar rules, if applicable.
Example generated
{ "code": "example", "message": "example", "details": {}, "notices": [ "example" ]}Unauthenticated
object
Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).
Human-readable description of the error.
Optional additional context about the error.
object
Policy notices from determining Cedar rules, if applicable.
Example generated
{ "code": "example", "message": "example", "details": {}, "notices": [ "example" ]}Forbidden
object
Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).
Human-readable description of the error.
Optional additional context about the error.
object
Policy notices from determining Cedar rules, if applicable.
Example generated
{ "code": "example", "message": "example", "details": {}, "notices": [ "example" ]}