---
title: "Create Policy Guard Rule"
method: POST
path: "/v2/policy_guards/scopes/{policy_guard_scope_id}/rules"
tags: ["Policy Guards (EAP)"]
---

# Create Policy Guard Rule

`POST /v2/policy_guards/scopes/{policy_guard_scope_id}/rules`

Create a policy guard rule.

## Path parameters

- `policy_guard_scope_id` string, required — Either the unique id of the policy_guard_scope, or the URL-friendly key of the policy_guard_scope (i.e: the "slug").

## Query parameters

- `wait` number — Time in seconds to wait for the task to complete. Default is 0, means no wait.

## Request body

- PolicyGuardRuleCreate
  - `is_allowed` boolean, required — If True, the permission will be allowed for the role in the policy guard across all projectswithin the policy scope, and the permission will be locked from further editing.
  - `resource_key` string, required — The key of the resource.
  - `role_key` string — The key of the role.
  - `action_key` string, required — The key of the action.
  - `resource_set` ConditionSet
    - `key` string, required — The key of the condition set.
    - `attribute` string, required — The attribute of the condition set.
    - `operator` string, required — The operator of the condition set.
    - `value` string, required — The value of the condition set.
  - `user_set` ConditionSet
    - `key` string, required — The key of the condition set.
    - `attribute` string, required — The attribute of the condition set.
    - `operator` string, required — The operator of the condition set.
    - `value` string, required — The value of the condition set.

## Response `200`

Successful Response

- TaskResultPolicyGuardScopeRead
  - `task_id` string, required — The unique id of the task.
  - `status` 'processing' | 'success' | 'failure' | 'cancelled', required — An enumeration.
  - `result` PolicyGuardScopeRead
    - `key` string, required — The unique key of the policy guard scope.
    - `id` string, uuid, required — Unique id of the ScopeConfig
    - `organization_id` string, uuid, required — Unique id of the organization that the ScopeConfig belongs to.
    - `policy_guard_scope_details` PolicyGuardScopeDetail[] — list of projects that this policy guard is assigned to.
      - `project_id` string, uuid, required — Unique id of the project that the ScopeConfig belongs to.
  - `error` ErrorDetails
    - `id` string, required
    - `title` string, required
    - `support_link` string, uri
    - `error_code` 'INVALID_INPUT' | 'INVALID_JWKS_CONFIGURATION' | 'UNEXPECTED_ERROR' | 'NOT_FOUND' | 'DUPLICATE_ENTITY' | 'EMPTY_DECISION_LOGS' | 'MISSING_REQUEST_ATTRIBUTE' | 'FORBIDDEN_ACCESS' | 'INVALID_PERMISSION_FORMAT' | 'MISSING_PERMISSIONS' | 'UNSUPPORTED_ATTRIBUTE_TYPE' | 'MISSING_RESOURCE_ATTRIBUTE' | 'MISMATCH_ATTRIBUTES_TYPES' | 'INVALID_POLICY_REPO_STATUS' | 'INVALID_SMTP_CONFIGURATION' | 'MISMATCH_RESOURCE_INSTANCES_TENANTS' | 'PAGINATION_SIZE_OVERREACHED' | 'MISMATCH_RELATION_TYPE' | 'CONCURRENT_OPERATION_DISALLOWED' | 'UNAUTHORIZED', required — An enumeration.
    - `message` string
    - `additional_info` unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/permit/apis/permit-io-api.md) · [All operations](https://skmtc.dev/permit/apis/permit-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/permit/permit-io-api/revisions/13faa12b4692/schema)
