> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opal.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Post access rules

> Creates a new access rule config for the given group_id.



## OpenAPI

````yaml https://app.opal.dev/openapi.yaml post /access-rules
openapi: 3.1.0
info:
  contact:
    email: hello@opal.dev
    name: Opal Team
    url: https://www.opal.dev/
  description: >-
    The Opal API is a RESTful API that allows you to interact with the Opal
    Security platform programmatically.
  title: Opal API
  version: '1.0'
servers:
  - description: Production
    url: https://api.opal.dev/v1
security: []
tags:
  - name: access-rules
    description: Operations related to access rules
  - name: apps
    description: Operations related to apps
  - name: bundles
    description: Operations related to bundles
  - name: configuration-templates
    description: Operations related to configuration templates
  - name: delegations
    description: Operations related to request reviewer delegations
  - name: events
    description: Operations related to events
  - name: groups
    description: Operations related to groups
  - name: group-bindings
    description: Operations related to group bindings
  - name: idp-group-mappings
    description: Operations related to IDP group mappings
  - name: message-channels
    description: Operations related to message channels
  - name: non-human-identities
    description: Operations related to non-human identities
  - name: on-call-schedules
    description: Operations related to on-call schedules
  - name: owners
    description: Operations related to owners
  - name: requests
    description: Operations related to requests
  - name: resources
    description: Operations related to resources
  - name: sessions
    description: Operations related to sessions
  - name: tags
    description: Operations related to tags
  - name: tokens
    description: Operations related to API tokens
  - name: uars
    description: Operations related to UARs
  - name: users
    description: Operations related to users
paths:
  /access-rules:
    post:
      tags:
        - access-rules
      description: Creates a new access rule config for the given group_id.
      operationId: create_access_rule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAccessRuleInfo'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessRule'
          description: The created access rule config for the group.
      security:
        - BearerAuth: []
components:
  schemas:
    UpdateAccessRuleInfo:
      description: >-
        # UpdateAccessRuleInfo Object

        ### Description

        The `UpdateAccessRuleInfo` object is used as an input to the
        UpdateAccessRule and CreateAccessRule API.
      properties:
        name:
          description: The name of the access rule.
          example: Platform Engineering
          type: string
        description:
          description: A description of the group.
          example: This access rule represents all platform engineers in the company.
          type: string
        admin_owner_id:
          description: The ID of the owner of the group.
          example: 7c86c85d-0651-43e2-a748-d69d658418e8
          format: uuid
          type: string
        status:
          description: The status of the access rule.
          type: string
          enum:
            - ACTIVE
            - PAUSED
          example: ACTIVE
        ruleClauses:
          $ref: '#/components/schemas/RuleClauses'
      required:
        - status
        - ruleClauses
        - name
        - admin_owner_id
        - description
    AccessRule:
      description: >-
        # Access Rule Object

        ### Description

        The `AccessRule` object is used to represent an access rule
        configuration.


        ### Usage Example

        List access rules from the `GET /access-rules` endpoint, or retrieve a
        single access rule from the `GET /access-rules/{access_rule_id}`
        endpoint.
      properties:
        access_rule_id:
          description: The ID (group ID) of the access rule.
          example: 7c86c85d-0651-43e2-a748-d69d658418e8
          format: uuid
          type: string
        name:
          description: The name of the access rule.
          example: Platform Engineering
          type: string
        description:
          description: A description of the group.
          example: This access rule represents all platform engineers in the company.
          type: string
        admin_owner_id:
          description: The ID of the owner of the group.
          example: 7c86c85d-0651-43e2-a748-d69d658418e8
          format: uuid
          type: string
        status:
          description: The status of the access rule.
          type: string
          enum:
            - ACTIVE
            - PAUSED
          example: ACTIVE
        ruleClauses:
          $ref: '#/components/schemas/RuleClauses'
      required:
        - status
        - ruleClauses
        - name
        - admin_owner_id
        - access_rule_id
        - description
    RuleClauses:
      properties:
        when:
          $ref: '#/components/schemas/RuleConjunction'
        unless:
          $ref: '#/components/schemas/RuleConjunction'
      required:
        - when
    RuleConjunction:
      properties:
        clauses:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/RuleDisjunction'
      required:
        - clauses
    RuleDisjunction:
      properties:
        selectors:
          type: array
          items:
            $ref: '#/components/schemas/TagSelector'
        attribute_selectors:
          type: array
          items:
            $ref: '#/components/schemas/UserAttributeSelector'
      required:
        - selectors
    TagSelector:
      properties:
        key:
          type: string
        value:
          type: string
        connection_id:
          type: string
          format: uuid
      required:
        - key
        - value
        - connection_id
    UserAttributeSelector:
      properties:
        attribute:
          type: string
          enum:
            - HR_IDP_STATUS
        values:
          type: array
          items:
            type: string
      required:
        - attribute
        - values
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````