> ## 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.

# Get access rule by ID

> Returns a list of access rule config given the group_id of the access rule.



## OpenAPI

````yaml https://app.opal.dev/openapi.yaml get /access-rules/{access_rule_id}
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: agent-activity
    description: Operations related to agent activity telemetry
  - name: apps
    description: Operations related to apps
  - name: bundles
    description: Operations related to bundles
  - name: campaigns
    description: Operations related to access review campaigns
  - name: configuration-templates
    description: Operations related to configuration templates
  - name: delegations
    description: Operations related to request reviewer delegations
  - name: event-streams
    description: Operations related to event streaming connections
  - 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: idp-user-attribute-mappings
    description: >-
      Operations related to the user attributes Opal imports from identity
      providers and HRIS apps
  - name: ip-acl
    description: >-
      Operations related to the API IP allowlist (IP zones and its enforcement
      setting)
  - 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: opal-queries
    description: Operations related to OpalQuery
  - name: opal-scripts
    description: Operations related to OpalScripts
  - name: owners
    description: Operations related to owners
  - name: requests
    description: Operations related to requests
  - name: resources
    description: Operations related to resources
  - name: role-assignments
    description: >-
      Operations related to role assignments (general grants between an entity
      and a principal)
  - name: paladin
    description: Operations related to Paladin
  - name: service-users
    description: Operations related to service users (non-human identities owned by a team)
  - 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. Deprecated in favor of the `campaigns` API.
  - name: users
    description: Operations related to users
paths:
  /access-rules/{access_rule_id}:
    get:
      tags:
        - access-rules
      summary: Get access rule by ID
      description: >-
        Returns a list of access rule config given the group_id of the access
        rule.
      operationId: get_access_rule
      parameters:
        - description: The access rule ID (group ID) of the access rule.
          example: 1b978423-db0a-4037-a4cf-f79c60cb67b3
          explode: false
          in: path
          name: access_rule_id
          required: true
          schema:
            type: string
            format: uuid
          style: simple
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessRule'
          description: The access rules for the group.
      security:
        - BearerAuth: []
components:
  schemas:
    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'
          description: >
            Tag-based CNF conditions. Present for tag-only rules, tags-as-query
            rules, and hybrids (tags AND an Opal Query). Empty `when.clauses`
            for pure Opal Query rules.
        query:
          $ref: '#/components/schemas/OpalNodeQueryBody'
          description: >
            Opal Query defining the user set when this rule uses one. For
            hybrids, both `ruleClauses` and `query` are set (AND). Omitted for
            tag-only rules and when the REST dialect cannot express the stored
            filter. Same NODE filter body as `POST /queries/run`.
        uses_opal_query:
          description: >
            True when the access rule stores an Opal Query (including hybrids).
            `query` is set when the REST dialect can express that filter; it is
            omitted for filters the API cannot express (e.g. risk, identity
            detection, agent fields). Rely on this flag, not only on whether
            `query` is present.
          example: false
          type: boolean
      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
    OpalNodeQueryBody:
      type: object
      description: The filter body for a NODE-type OpalQuery.
      properties:
        nodeFilters:
          $ref: '#/components/schemas/AccessEntityFilters'
        accessFilters:
          $ref: '#/components/schemas/AccessRelationshipFilters'
    RuleConjunction:
      properties:
        clauses:
          description: Empty only when the access rule has `uses_opal_query` set.
          type: array
          items:
            $ref: '#/components/schemas/RuleDisjunction'
      required:
        - clauses
    AccessEntityFilters:
      type: object
      description: >-
        Filters for matching entities by type, name, tag, IDs, connections, or
        access levels. Supports recursive logical composition via allOf/anyOf.
      properties:
        entityTypes:
          type: array
          description: >-
            Filter by entity type. Only RESOURCE, GROUP, and USER are queryable
            via OpalQuery.
          items:
            type: string
            enum:
              - RESOURCE
              - GROUP
              - USER
        entityItemTypes:
          type: array
          description: Filter by entity item types.
          items:
            $ref: '#/components/schemas/EntityItemTypeEnum'
        entityName:
          $ref: '#/components/schemas/EntityNameFilter'
        entityDescription:
          $ref: '#/components/schemas/EntityDescriptionFilter'
        entityTag:
          $ref: '#/components/schemas/EntityTagFilter'
        entityTagKey:
          $ref: '#/components/schemas/EntityTagKeyFilter'
        hrIdpStatus:
          $ref: '#/components/schemas/IdpStatusFilter'
        entityAdminOwner:
          $ref: '#/components/schemas/EntityAdminFilter'
        userTitle:
          $ref: '#/components/schemas/UserTitleFilter'
        userTeam:
          $ref: '#/components/schemas/UserTeamFilter'
        userManager:
          $ref: '#/components/schemas/UserManagerFilter'
        entityIDs:
          type: array
          description: Filter by specific entity UUIDs.
          items:
            type: string
            format: uuid
        importedFromApp:
          type: array
          description: Filter by app IDs from which returned nodes will be imported from.
          items:
            type: string
            format: uuid
        roleRemoteIds:
          type: array
          description: >-
            Filter by role remote IDs. Can only be applied within a hasAccessTo
            clause.
          items:
            type: string
        roleNames:
          type: array
          description: >-
            Filter by role display names (e.g. "Admin", "Read"). Can only be
            applied within a hasAccessTo clause.
          items:
            type: string
        allOf:
          type: array
          description: |
            A list of nested filters that must all match (logical AND). Each
             item has the same shape as this object — scalar fields like
             `entityTypes` or `entityTag`, and can further nest `allOf`,
             `anyOf`, or `not`.
          items:
            $ref: '#/components/schemas/AccessEntityFilters'
        anyOf:
          type: array
          description: |
            A list of nested filters where at least one must match (logical
             OR). Each item has the same shape as this object.
          items:
            $ref: '#/components/schemas/AccessEntityFilters'
        not:
          description: >
            Excludes entities matching the embedded filter (logical NOT). Pass a
            filter object with the same shape as this one — typically a single
            scalar field, like `{not: {entityTypes: ["RESOURCE"]}}` to exclude
            resources.
          type: object
          x-go-type: AccessEntityFilters
    AccessRelationshipFilters:
      type: object
      description: >
        Filters the returned nodes by the access edges connected to them. When
        `isAccessibleBy` and `hasAccessTo` are provided, the returned nodes must
        satisfy both edge constraints simultaneously. Supports nested
        composition via `allOf` / `anyOf` / `not`, and `directOnly` to restrict
        matching to direct grants.
      properties:
        isAccessibleBy:
          $ref: '#/components/schemas/AccessEntityFilters'
          description: >-
            Inbound-edge filter. The returned node must be accessible by at
            least one entity matching this filter.
        hasAccessTo:
          $ref: '#/components/schemas/AccessEntityFilters'
          description: >-
            Outbound-edge filter. The returned node must have access to at least
            one entity matching this filter.
        directOnly:
          type: boolean
          description: >
            When true, `hasAccessTo` / `isAccessibleBy` match only direct role
            assignments (no nested group membership expansion).
          example: true
        allOf:
          type: array
          description: |
            Nested access filters that must all match (logical AND).
          items:
            $ref: '#/components/schemas/AccessRelationshipFilters'
        anyOf:
          type: array
          description: |
            Nested access filters where at least one must match (logical OR).
          items:
            $ref: '#/components/schemas/AccessRelationshipFilters'
        not:
          description: |
            Excludes nodes matching the embedded access filter (logical NOT).
          type: object
          x-go-type: AccessRelationshipFilters
    RuleDisjunction:
      properties:
        selectors:
          type: array
          items:
            $ref: '#/components/schemas/TagSelector'
        attribute_selectors:
          type: array
          items:
            $ref: '#/components/schemas/UserAttributeSelector'
      required:
        - selectors
    EntityItemTypeEnum:
      description: Granular subtype of an entity.
      enum:
        - USER
        - SERVICE_USER
        - ACTIVE_DIRECTORY_GROUP
        - AWS_SSO_GROUP
        - DUO_GROUP
        - GIT_HUB_TEAM
        - GIT_LAB_GROUP
        - GOOGLE_GROUPS_GROUP
        - GOOGLE_GROUPS_GKE_GROUP
        - LDAP_GROUP
        - OKTA_GROUP
        - OKTA_GROUP_RULE
        - TAILSCALE_GROUP
        - TWINGATE_GROUP
        - TWINGATE_GROUP_SYNCED
        - OPAL_GROUP
        - OPAL_ACCESS_RULE
        - AZURE_AD_SECURITY_GROUP
        - AZURE_AD_MICROSOFT_365_GROUP
        - CONNECTOR_GROUP
        - SNOWFLAKE_ROLE
        - WORKDAY_USER_SECURITY_GROUP
        - DATABRICKS_ACCOUNT_GROUP
        - AWS_IAM_ROLE
        - AWS_EC2_INSTANCE
        - AWS_EKS_CLUSTER
        - AWS_RDS_POSTGRES_INSTANCE
        - AWS_RDS_POSTGRES_CLUSTER
        - AWS_RDS_MYSQL_INSTANCE
        - AWS_RDS_MYSQL_CLUSTER
        - AWS_ACCOUNT
        - AWS_SSO_PERMISSION_SET
        - AWS_AGENTCORE_GATEWAY
        - AWS_AGENTCORE_GATEWAY_TARGET
        - AWS_AGENTCORE_GATEWAY_TOOL
        - AZURE_MANAGEMENT_GROUP
        - AZURE_RESOURCE_GROUP
        - AZURE_SUBSCRIPTION
        - AZURE_VIRTUAL_MACHINE
        - AZURE_STORAGE_ACCOUNT
        - AZURE_STORAGE_CONTAINER
        - AZURE_SQL_SERVER
        - AZURE_SQL_MANAGED_INSTANCE
        - AZURE_SQL_DATABASE
        - AZURE_SQL_MANAGED_DATABASE
        - AZURE_USER_ASSIGNED_MANAGED_Identity
        - AZURE_ENTRA_ID_ROLE
        - AZURE_ENTERPRISE_APP
        - CUSTOM
        - CUSTOM_CONNECTOR
        - GCP_ORGANIZATION
        - GCP_BUCKET
        - GCP_COMPUTE_INSTANCE
        - GCP_BIG_QUERY_DATASET
        - GCP_BIG_QUERY_TABLE
        - GCP_FOLDER
        - GCP_GKE_CLUSTER
        - GCP_PROJECT
        - GCP_CLOUD_SQL_POSTGRES_INSTANCE
        - GCP_CLOUD_SQL_MYSQL_INSTANCE
        - GCP_SERVICE_ACCOUNT
        - GCP_BILLING_ACCOUNT
        - GIT_HUB_REPO
        - GIT_HUB_ORG_ROLE
        - GIT_LAB_PROJECT
        - GOOGLE_WORKSPACE_ROLE
        - MONGO_INSTANCE
        - MONGO_ATLAS_INSTANCE
        - OKTA_APP
        - OKTA_ROLE
        - OPAL_ROLE
        - OPAL_SCOPED_ROLE
        - PAGERDUTY_ROLE
        - TAILSCALE_SSH
        - TWINGATE_RESOURCE
        - SALESFORCE_PERMISSION_SET
        - SALESFORCE_PROFILE
        - SALESFORCE_ROLE
        - SNOWFLAKE_DATABASE
        - SNOWFLAKE_SCHEMA
        - SNOWFLAKE_TABLE
        - WORKDAY_ROLE
        - MYSQL_INSTANCE
        - MARIADB_INSTANCE
        - POSTGRES_INSTANCE
        - TELEPORT_ROLE
        - DATABRICKS_ACCOUNT_SERVICE_PRINCIPAL
        - ILEVEL_ADVANCED_ROLE
        - DATABRICKS_CATALOG
        - DATABRICKS_SCHEMA
        - DATABRICKS_VOLUME
        - DATABRICKS_FUNCTION
        - DATABRICKS_MODEL
        - DATABRICKS_SERVICE
        - DATABRICKS_MCP_SERVER
      example: OPAL_ROLE
      type: string
    EntityNameFilter:
      type: object
      required:
        - stringMatchType
        - string
      description: Filters entities by name using a string match strategy.
      properties:
        stringMatchType:
          $ref: '#/components/schemas/StringMatchType'
        string:
          type: string
          description: The string value to match against the entity name.
          example: engineering
    EntityDescriptionFilter:
      type: object
      required:
        - string
      description: >
        Filters GROUP and RESOURCE entities by a case-insensitive substring of
        their description ("contains"). USER entities have no description and
        never match, in either polarity. `not` inverts the match within the
        resource/group domain ("does NOT contain"), so it still returns only
        resources/groups rather than sweeping in users.
      properties:
        string:
          type: string
          description: The substring to match against the entity description.
          example: production
        not:
          type: boolean
          description: >-
            Invert the match — return resources/groups whose description does
            NOT contain the substring.
    EntityTagFilter:
      type: object
      required:
        - key
      description: >-
        Filters entities by a tag key/value pair, optionally scoped to a
        connection.
      properties:
        key:
          type: string
          description: The tag key to filter by.
          example: team
        value:
          type: string
          description: >-
            The tag value to filter by. If omitted, matches only tags with no
            value; use entityTagKey to match any value for a key.
          example: platform
        connectionId:
          type: string
          format: uuid
          description: If specified, filters by tags associated with this connection.
    EntityTagKeyFilter:
      type: object
      required:
        - keys
      description: >
        Filters entities that have a tag whose key is one of `keys`, whatever
        its value (including no value). Keys match exactly and case-sensitively.
        An empty list matches nothing. AGENT entities carry no tags, so they
        never match; under `not`, every agent matches, as with entityTag.
      properties:
        keys:
          type: array
          description: The tag keys to match.
          items:
            type: string
          example:
            - Critical
    IdpStatusFilter:
      type: object
      description: >
        Filters USER entities by their HR/IDP lifecycle status. Only applies to
        USER entities; GROUP and RESOURCE entities never match, in either
        polarity. `statuses` combine with OR. `not` inverts the match within the
        user domain (e.g. "IDP status is NOT active"), so it still returns only
        users rather than sweeping in groups/resources.
      properties:
        statuses:
          type: array
          description: Match users whose HR/IDP status is one of these values.
          items:
            $ref: '#/components/schemas/UserHrIdpStatusEnum'
        not:
          type: boolean
          description: >-
            Invert the match within the user domain (e.g. "IDP status is NOT
            active").
    EntityAdminFilter:
      type: object
      required:
        - ownerIDs
      description: >
        Filters GROUP and RESOURCE entities by their admin owner. USER entities
        never match, in either polarity. `not` inverts the match within the
        resource/group domain (self-negating, like IdpStatusFilter): omit it (or
        false) to include entities owned by the given owners, set it true to
        exclude them.
      properties:
        ownerIDs:
          type: array
          description: The owner (group) UUIDs to match entities against.
          items:
            type: string
            format: uuid
        not:
          type: boolean
          description: >-
            Invert the match — return resources/groups NOT owned by the given
            owners.
    UserTitleFilter:
      type: object
      description: >
        Filters USER entities by job title (`users.position`). Non-users never
        match, in either polarity. `strings` is an exact-match OR list; `unset`
        also matches users with no title; `not` inverts the whole match.
      properties:
        strings:
          type: array
          items:
            type: string
          description: Exact job titles to match (OR).
          example:
            - Software Engineer
            - Staff Engineer
        unset:
          type: boolean
          description: When true, also match users with no job title.
        not:
          type: boolean
          description: Invert the match within the user domain.
    UserTeamFilter:
      type: object
      description: >
        Filters USER entities by team attribute (`users.team_attr`). Non-users
        never match, in either polarity. `strings` is an exact-match OR list;
        `unset` also matches users with no team; `not` inverts the whole match.
      properties:
        strings:
          type: array
          items:
            type: string
          description: Exact team names to match (OR).
          example:
            - Platform
            - Infrastructure
        unset:
          type: boolean
          description: When true, also match users with no team.
        not:
          type: boolean
          description: Invert the match within the user domain.
    UserManagerFilter:
      type: object
      description: >
        Filters USER entities by manager (`users.manager_id`). Non-users never
        match, in either polarity. `userIds` combine with OR; `unset` also
        matches users with no manager; `not` inverts the whole match.
      properties:
        userIds:
          type: array
          items:
            type: string
            format: uuid
          description: Manager user IDs to match (OR).
        unset:
          type: boolean
          description: When true, also match users with no manager.
        not:
          type: boolean
          description: Invert the match within the user domain.
    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:
          description: >-
            Values to match; a user matches if their attribute equals any of
            them. For HR_IDP_STATUS, use HrIdpStatus values, or UNSET for users
            with no IDP status (shown as "Inactive"). UNSET must be the last
            value.
          type: array
          items:
            type: string
      required:
        - attribute
        - values
    StringMatchType:
      type: string
      description: >-
        How to match a string value against entity names. REGEX matches the
        value as a case-insensitive regular expression.
      enum:
        - CONTAINS
        - EQUALS
        - STARTS_WITH
        - ENDS_WITH
        - REGEX
    UserHrIdpStatusEnum:
      description: User status pulled from an HR/IDP provider.
      enum:
        - ACTIVE
        - SUSPENDED
        - DEPROVISIONED
        - DELETED
        - NOT_FOUND
      example: ACTIVE
      type: string
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.