---
title: "Get a rule"
method: GET
path: "/groups/{groupId}/apps/{appId}/services/{serviceId}/rules/{ruleId}"
tags: ["rules"]
---

# Get a rule

`GET /groups/{groupId}/apps/{appId}/services/{serviceId}/rules/{ruleId}`

Get a specific [data access rule](https://www.mongodb.com/docs/atlas/app-services/rules).

## Response `200`

Successfully retrieved.

- union
  - Rule — A data access rule that defines user roles and query filters for a collection in a linked data source.
    - `_id` string — The rule's unique ObjectId identifier.
    - `roles` object[] — A list of data access roles.
      - `document_filters` object
        - `read` union, required — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
          - object
          - boolean
        - `write` union, required — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
          - object
          - boolean
      - `name` string — The role's name.
      - `apply_when` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `read` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `write` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `insert` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `delete` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `search` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `fields` unknown
      - `additional_fields` FieldLevelPermissions — Read and write permissions for a field.
        - `read` union, required — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
          - object
          - boolean
        - `write` union, required — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
          - object
          - boolean
    - `filters` object[] — A list of filters for incoming operations.
      - `_id` string — The filter's unique ObjectId identifier.
      - `name` string — The filter's name.
      - `apply_when` union — A [rule expression](https://mongodb.com/docs/atlas/app-services/rules/expressions/).
        - object
        - boolean
      - `query` Query — A MongoDB query object.
      - `projection` Projection — A MongoDB projection object.
    - `database` string, required — The name of a database in the linked data source.
    - `collection` string, required — The name of a collection in the specified `database`.
  - ThirdPartyServiceRule — [Deprecated] A rule for a third-party service.
    - `name` string, required
    - `actions` string[]
    - `when` object, required

## Changes

- **2024-02-20** (v3) `e2240dd053bd` — 3 breaking, 3 warning, 1 info
  - the `oneOf[#/components/schemas/Rule]/` response's property type changed from `object` to no type for status `200`
  - removed the required property `oneOf[#/components/schemas/Rule]/collection` from the response with the `200` status
  - removed the required property `oneOf[#/components/schemas/Rule]/database` from the response with the `200` status
  - removed the optional property `oneOf[#/components/schemas/Rule]/_id` from the response with the `200` status
  - …3 more

[Change history](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/changes/groups/:groupId/apps/:appId/services/:serviceId/rules/:ruleId/get.md)

---

[API](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api.md) · [All operations](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/revisions/1365ab72bc03?raw)
