Create rule in policy
const url = 'https://example.com/v1/policies/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules';const options = { method: 'POST', headers: { 'X-Tenant-ID': '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0', 'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json' }, body: '{"policy_text":"example","effect":"permit","principal_scope_type":"any","principal_entity_type":"example","principal_entity_id":"example","action_scope_type":"any","action_ids":["example"],"resource_scope_type":"any","resource_entity_type":"example","resource_entity_id":"example","conditions":"example","ordinal":1,"notice":"example","audit_session":true}'};
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/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --header 'X-Tenant-ID: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --data '{ "policy_text": "example", "effect": "permit", "principal_scope_type": "any", "principal_entity_type": "example", "principal_entity_id": "example", "action_scope_type": "any", "action_ids": [ "example" ], "resource_scope_type": "any", "resource_entity_type": "example", "resource_entity_id": "example", "conditions": "example", "ordinal": 1, "notice": "example", "audit_session": true }'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path 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 rule within a policy. Provide either policy_text (single Cedar statement) or structured fields. If both are present, policy_text takes precedence.
object
Single Cedar statement (takes precedence over structured fields).
Raw Cedar when/unless clause text.
Evaluation order (auto-assigned if omitted).
Responses
Section titled “ Responses ”Created
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.
Example
{ "effect": "permit", "principal_scope_type": "any", "action_scope_type": "any", "resource_scope_type": "any"}Invalid 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" ]}Not found
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" ]}