---
title: "Create Group Rule"
method: POST
path: "/api/v1/groups/rules"
tags: ["Group"]
---

# Create Group Rule

`POST /api/v1/groups/rules`

## Request

- Base URL: `https://your-subdomain.okta.com`
- URL: `https://your-subdomain.okta.com/api/v1/groups/rules`
- Auth: API key in header `Authorization`

Creates a group rule to dynamically add users to the specified group if they match the condition

## Request body

- GroupRule
  - `actions` GroupRuleAction
    - `assignUserToGroups` GroupRuleGroupAssignment
      - `groupIds` string[]
  - `conditions` GroupRuleConditions
    - `expression` GroupRuleExpression
      - `type` string
      - `value` string
    - `people` GroupRulePeopleCondition
      - `groups` GroupRuleGroupCondition
        - `exclude` string[]
        - `include` string[]
      - `users` GroupRuleUserCondition
        - `exclude` string[]
        - `include` string[]
  - `created` string, date-time
  - `id` string
  - `lastUpdated` string, date-time
  - `name` string
  - `status` 'ACTIVE' | 'INACTIVE' | 'INVALID'
  - `type` string

## Response `200`

Success

- GroupRule
  - `actions` GroupRuleAction
    - `assignUserToGroups` GroupRuleGroupAssignment
      - `groupIds` string[]
  - `conditions` GroupRuleConditions
    - `expression` GroupRuleExpression
      - `type` string
      - `value` string
    - `people` GroupRulePeopleCondition
      - `groups` GroupRuleGroupCondition
        - `exclude` string[]
        - `include` string[]
      - `users` GroupRuleUserCondition
        - `exclude` string[]
        - `include` string[]
  - `created` string, date-time
  - `id` string
  - `lastUpdated` string, date-time
  - `name` string
  - `status` 'ACTIVE' | 'INACTIVE' | 'INVALID'
  - `type` string

---

[API](https://skmtc.dev/okta/apis/okta-api.md) - [All operations](https://skmtc.dev/okta/apis/okta-api/llms.txt) - [OpenAPI document](https://skmtc.dev/okta/apis/okta-api/revisions/7e5249c30571?raw)
