Skip to content

Create rule in policy

POST
/v1/policies/{policyId}/rules
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 }'
policyId
required
string format: uuid
X-Tenant-ID
required
string format: uuid

Tenant identifier. Must match the tenant associated with the credential. Returns 403 tenant_mismatch if the credential and header belong to different tenants.

Media type application/json

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
policy_text

Single Cedar statement (takes precedence over structured fields).

string
nullable
effect
string
Allowed values: permit forbid
principal_scope_type
string
Allowed values: any eq in is is_in
principal_entity_type
string
nullable
principal_entity_id
string
nullable
action_scope_type
string
Allowed values: any eq in
action_ids
Array<string>
resource_scope_type
string
Allowed values: any eq in is is_in
resource_entity_type
string
nullable
resource_entity_id
string
nullable
conditions

Raw Cedar when/unless clause text.

string
nullable
ordinal

Evaluation order (auto-assigned if omitted).

integer
nullable
notice
string
nullable
audit_session
boolean
default: true

Created

Media type application/json

Single rule within a policy.

object
id
required
string format: uuid
ordinal
required

Evaluation order within the policy.

integer
effect
required
string
Allowed values: permit forbid
policy_text
required

Assembled Cedar text for this rule.

string
principal_scope_type
required
string
Allowed values: any eq in is is_in
principal_entity_type
string
nullable
principal_entity_id
string
nullable
action_scope_type
required
string
Allowed values: any eq in
action_ids
Array<string>
resource_scope_type
required
string
Allowed values: any eq in is is_in
resource_entity_type
string
nullable
resource_entity_id
string
nullable
conditions

Raw Cedar when/unless clause text.

string
nullable
notice

User-facing message for this rule.

string
nullable
audit_session

Whether grants should have session auditing.

boolean
created_at
required
string format: date-time
Example
{
"effect": "permit",
"principal_scope_type": "any",
"action_scope_type": "any",
"resource_scope_type": "any"
}

Invalid Cedar policy.

Media type application/json
object
code
required

Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).

string
message
required

Human-readable description of the error.

string
details

Optional additional context about the error.

object
key
additional properties
any
notices

Policy notices from determining Cedar rules, if applicable.

Array<string>
Example generated
{
"code": "example",
"message": "example",
"details": {},
"notices": [
"example"
]
}

Unauthenticated

Media type application/json
object
code
required

Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).

string
message
required

Human-readable description of the error.

string
details

Optional additional context about the error.

object
key
additional properties
any
notices

Policy notices from determining Cedar rules, if applicable.

Array<string>
Example generated
{
"code": "example",
"message": "example",
"details": {},
"notices": [
"example"
]
}

Forbidden

Media type application/json
object
code
required

Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).

string
message
required

Human-readable description of the error.

string
details

Optional additional context about the error.

object
key
additional properties
any
notices

Policy notices from determining Cedar rules, if applicable.

Array<string>
Example generated
{
"code": "example",
"message": "example",
"details": {},
"notices": [
"example"
]
}

Not found

Media type application/json
object
code
required

Machine-readable error code (e.g. “not_found”, “tenant_mismatch”).

string
message
required

Human-readable description of the error.

string
details

Optional additional context about the error.

object
key
additional properties
any
notices

Policy notices from determining Cedar rules, if applicable.

Array<string>
Example generated
{
"code": "example",
"message": "example",
"details": {},
"notices": [
"example"
]
}