---
title: "Create Condition Set"
method: POST
path: "/v2/schema/{proj_id}/{env_id}/condition_sets"
tags: ["Condition Sets"]
---

# Create Condition Set

`POST /v2/schema/{proj_id}/{env_id}/condition_sets`

Creates a new condition set (can be either a user set or a resource set).

## Path parameters

- `proj_id` string, required — Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").
- `env_id` string, required — Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

## Request body

- ConditionSetCreate
  - `key` string, required — A unique id by which Permit will identify the condition set. The key will be used as the generated rego rule name.
  - `type` 'userset' | 'resourceset' — An enumeration.
  - `autogenerated` boolean — whether the set was autogenerated by the system.
  - `resource_id` union — For ResourceSets, the id of the base resource.
    - string
    - string, uuid
  - `name` string, required — A descriptive name for the set, i.e: 'US based employees' or 'Users behind VPN'
  - `description` string — an optional longer description of the set
  - `conditions` object — a boolean expression that consists of multiple conditions, with and/or logic.
  - `parent_id` union — Parent Condition Set
    - string
    - string, uuid

## Response `200`

Successful Response

- ConditionSetRead
  - `key` string, required — A unique id by which Permit will identify the condition set. The key will be used as the generated rego rule name.
  - `type` 'userset' | 'resourceset' — An enumeration.
  - `autogenerated` boolean — whether the set was autogenerated by the system.
  - `resource_id` union — For ResourceSets, the id of the base resource.
    - string
    - string, uuid
  - `id` string, uuid, required — Unique id of the condition set
  - `organization_id` string, uuid, required — Unique id of the organization that the condition set belongs to.
  - `project_id` string, uuid, required — Unique id of the project that the condition set belongs to.
  - `environment_id` string, uuid, required — Unique id of the environment that the condition set belongs to.
  - `created_at` string, date-time, required — Date and time when the condition set was created (ISO_8601 format).
  - `updated_at` string, date-time, required — Date and time when the condition set was last updated/modified (ISO_8601 format).
  - `resource` ResourceRead
    - `key` string, required — A URL-friendly name of the resource (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the resource.
    - `id` string, uuid, required — Unique id of the resource
    - `organization_id` string, uuid, required — Unique id of the organization that the resource belongs to.
    - `project_id` string, uuid, required — Unique id of the project that the resource belongs to.
    - `environment_id` string, uuid, required — Unique id of the environment that the resource belongs to.
    - `created_at` string, date-time, required — Date and time when the resource was created (ISO_8601 format).
    - `updated_at` string, date-time, required — Date and time when the resource was last updated/modified (ISO_8601 format).
    - `name` string, required — The name of the resource
    - `urn` string — The [URN](https://en.wikipedia.org/wiki/Uniform_Resource_Name) (Uniform Resource Name) of the resource
    - `description` string — An optional longer description of what this resource respresents in your system
    - `actions` object — A actions definition block, typically contained within a resource type definition block. The actions represents the ways you can interact with a protected resource.
    - `type_attributes` object — optional dictionary of key-value pairs that can be used to store arbitrary metadata about this resource. This metadata can be used to filter resource using query parameters with attr_ prefix
    - `attributes` object — Attributes that each resource of this type defines, and can be used in your ABAC policies.
    - `roles` object — Roles defined on this resource. The key is the role name, and the value contains the role properties such as granted permissions, etc.
    - `relations` object — A relations definition block, typically contained within a resource type definition block. The relations represents the ways you can interact with a protected resource.
    - `v1compat_path` string
    - `v1compat_type` string
    - `v1compat_name` string
    - `action_groups` object
  - `name` string, required — A descriptive name for the set, i.e: 'US based employees' or 'Users behind VPN'
  - `description` string — an optional longer description of the set
  - `conditions` object — a boolean expression that consists of multiple conditions, with and/or logic.
  - `parent_id` union — Parent Condition Set
    - string
    - string, uuid

## 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/0235743bf8a2/schema)
