# Update Selection Rule

> **ALPHA**

#### Description
Selection Rules are used to resolve who should attend a Scheduling Request.
This API allows you to modify existing Selection Rules.

Authentication uses a `client_secret` of an [Internal Application](/developers/application-management/internal-applications/index.md) linked to the Organizational Unit.

#### URL format
```
{data_center_url}/v1/scheduler/selection_rules/{selection_rule_id}
```

#### Example Request
```http
PATCH /v1/scheduler/selection_rules/sel_5ebac6d468ed0fb37a1b6e4a HTTP/1.1
Host: {data_center_url}
Authorization: Bearer {API_TOKEN}
Content-Type: application/json; charset=utf-8

{
  "name": "Engineers",
  "required": 1,
  "members": {
    "add": [
      { "email": "bob@evenitron.com" },
      { "email": "eve@evenitron.com" }
    ],
    "remove": [
      { "email": "alice@evenitron.com" },
    ]
  }
}
```

#### Example Response
```http
HTTP/1.1 200 OK

{
  "selection_rule": {
    "sub": "sel_5ebac6d468ed0fb37a1b6e4a",
    "name": "Engineers",
    "required": 1,
    "members": [
      {
        "display_name": "Bob",
        "email": "bob@evenitron.com",
        "sub": "acc_6eac9d468e0fb111adde242"
      }
    ]
  },
  "diff_applied": {
    "members": {
      "added": [
        {
          "display_name": "Bob",
          "email": "bob@evenitron.com",
          "sub": "acc_6eac9d468e0fb111adde242"
        }
      ],
      "removed": [
        {
          "display_name": "Alice",
          "email": "alice@evenitron.com",
          "sub": "acc_5ebac6d468ed0fb37a1b6e4a"
        }
      ],
      "not_resolved": [
        { "email": "eve@evenitron.com" }
      ]
    }
  }
}
```

#### Request parameters
##### `data_center_url` *(required)*

The URL for the data center you want to communicate with. Possible choices are:

- `api-au.cronofy.com` - Australia
- `api-ca.cronofy.com` - Canada
- `api-de.cronofy.com` - Germany
- `api-sg.cronofy.com` - Singapore
- `api-uk.cronofy.com` - United Kingdom
- `api.cronofy.com` - United States

Find out more about [Cronofy's data centers](/developers/data-centers/index.md).
##### `selection_rule_id` *(required)*

The `selection_rule_id` of the Selection Rule you wish to modify

##### `name` *(optional)*

Set the name of the Selection Rule which will appear in the UI when creating or viewing Scheduling Requests.

##### `members` *(optional)*

An object representing the operations you want to be applied to modify the selection rule members:

##### `members.add` *(optional)*

A list of objects representing members to add to the selection rule.
Supported keys are:

- `email`: The email of the user you want to add to the rule

##### `members.remove` *(optional)*

A list of objects representing members to remove from the selection rule.
Supported keys are:

- `email`: The email of the user you want to remove from the rule

##### `required` *(optional)*

Updates the number of members that will be added to events. The value must be an integer, or can be the special value `&quot;all&quot;` if you want everyone in the rule to have to be available and added to the event.

#### Response parameters
##### `selection_rule`

An object representing the new state of the selection_rule. This is the same format as used in the [Show Selection Rule](/developers/api-alpha/organizational-unit-selection-rules/show-selection-rule/index.md) endpoint.

##### `diff_applied.members`

An object reporting the result of the members changes being applied.

##### `diff_applied.members.added`

An array of objects containing the details of the members added to the Selection Rule.

##### `diff_applied.members.removed`

An array of objects containing the details of the members removed from the Selection Rule.

##### `diff_applied.members.not_resolved` *(optional)*

A list of objects containing the emails that were in the request, but could not be resolved to a Cronofy account.
The user does not have an account in the Organizational Unit of the Selection Rule.



---
[Read in HTML](/developers/api-alpha/organizational-unit-selection-rules/update-selection-rule/)