# Конечные точки REST API для SCIM

Используйте REST API для автоматизации создания пользователей и членства в группах с помощью SCIM.

## Общие сведения о SCIM

> \[!NOTE]
> Эти конечные точки поддерживают проверку подлинности только с помощью personal access token (classic). Дополнительные сведения см. в разделе [Управление личными маркерами доступа](/ru/enterprise-server@3.18/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).

GitHub предоставляет конечные точки для использования поставщиками идентификации с поддержкой SCIM (IdP). Интеграция в IdP может использовать REST API для автоматического предоставления данных, управления или удаления учетных записей пользователей на GitHub Enterprise Server экземпляри, использующей SAML single sign-on (SSO) для аутентификации. См [. раздел AUTOTITLE](/ru/enterprise-server@3.18/admin/managing-iam/provisioning-user-accounts-with-scim/user-provisioning-with-scim-on-ghes).

Эти конечные точки основаны на SCIM 2.0. Дополнительные сведения см. в документации поставщика удостоверений или спецификации [на веб-сайте](https://datatracker.ietf.org/doc/html/rfc7644) IETF.

### Url-адреса корневого каталога

IdP может использовать следующий корневой URL для связи с конечными точками в этой категории для экземпляра GitHub Enterprise Server .

```http
http(s)://HOSTNAME/api/v3/scim/v2/
```

Не \*\*\*\* включайте `enterprises/{enterprise}/` часть URL-адресов, указанных в документации по конечной точке ниже. Эта часть пути не применима к GitHub Enterprise Server. В будущем эта документация будет показывать правильные URL для GitHub Enterprise Server.

Конечные точки в этой категории чувствительны к регистру. Например, первая буква в конечной точке `Users` должна быть прописной.

```shell
GET /scim/v2/Users/{scim_user_id}
```

### Проверка подлинности

Интеграция SCIM на IdP выполняет действия от имени владельца предприятия для экземпляра GitHub Enterprise Server . Дополнительные сведения см. в разделе [Возможности ролей на предприятии](/ru/enterprise-server@3.18/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owners).

Для аутентификации запросов API человек, настраивающий SCIM на IdP, должен использовать приложение personal access token (classic) с

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2022-11-28`. Curl examples below omit these standard headers for brevity.

## List provisioned SCIM groups for an enterprise

```
GET /scim/v2/enterprises/{enterprise}/Groups
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Lists provisioned SCIM groups in an enterprise.
You can improve query search time by using the excludedAttributes query parameter with a value of members to exclude members from the response.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`filter`** (string)
  If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are externalId, id, and displayName. For example, ?filter=externalId eq "9138790-10932-109120392-12321".

* **`excludedAttributes`** (string)
  Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time.

* **`startIndex`** (integer)
  Used for pagination: the starting index of the first result to return when paginating through values.
  Default: `1`

* **`count`** (integer)
  Used for pagination: the number of results to return per page.
  Default: `30`

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **200** - Success, either groups were found or not found

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups
```

**Response schema (Status: 200):**

* `schemas`: required, array of string, enum: `urn:ietf:params:scim:api:messages:2.0:ListResponse`
* `totalResults`: required, integer
* `Resources`: required, array of object
* `startIndex`: required, integer
* `itemsPerPage`: required, integer

## Provision a SCIM enterprise group

```
POST /scim/v2/enterprises/{enterprise}/Groups
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Creates a SCIM group for an enterprise.
If members are included as part of the group provisioning payload, they will be created as external group members. It is up to a provider to store a mapping between the externalId and id of each user.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`schemas`** (array of strings) (required)
  The URIs that are used to indicate the namespaces of the SCIM schemas.
  Supported values are: urn:ietf:params:scim:schemas:core:2.0:Group

* **`externalId`** (string) (required)
  A unique identifier for the resource as defined by the provisioning client.

* **`displayName`** (string) (required)
  A human-readable name for a security group.

* **`members`** (array of objects)
  The group members.
  * **`value`** (string) (required)
    The local unique identifier for the member
  * **`displayName`** (string) (required)
    The display name associated with the member

### HTTP response status codes

* **201** - Group has been created

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Group"
  ],
  "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
  "displayName": "Engineering",
  "members": [
    {
      "value": "879db59-3bdf-4490-ad68-ab880a2694745",
      "displayName": "User 1"
    },
    {
      "value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
      "displayName": "User 2"
    }
  ]
}'
```

**Response schema (Status: 201):**

* all of:
  * **object**
    * `schemas`: required, array of string, enum: `urn:ietf:params:scim:schemas:core:2.0:Group`, `urn:ietf:params:scim:api:messages:2.0:ListResponse`
    * `externalId`: string or null
    * `displayName`: string or null
    * `members`: array of objects:
      * `value`: required, string
      * `$ref`: required, string
      * `display`: string
  * **object**
    * `id`: string
    * `members`: array of objects:
      * `value`: string
      * `$ref`: string
      * `display`: string
    * `meta`: object:
      * `resourceType`: required, string, enum: `User`, `Group`
      * `created`: string
      * `lastModified`: string
      * `location`: string

## Get SCIM provisioning information for an enterprise group

```
GET /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Gets information about a SCIM group.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_group_id`** (string) (required)
  A unique identifier of the SCIM group.

* **`excludedAttributes`** (string)
  Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **200** - Success, a group was found

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise group](#provision-a-scim-enterprise-group).

## Set SCIM information for a provisioned enterprise group

```
PUT /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Replaces an existing provisioned group’s information.
You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the Update an attribute for a SCIM enterprise group endpoint instead.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_group_id`** (string) (required)
  A unique identifier of the SCIM group.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`schemas`** (array of strings) (required)
  The URIs that are used to indicate the namespaces of the SCIM schemas.
  Supported values are: urn:ietf:params:scim:schemas:core:2.0:Group

* **`externalId`** (string) (required)
  A unique identifier for the resource as defined by the provisioning client.

* **`displayName`** (string) (required)
  A human-readable name for a security group.

* **`members`** (array of objects)
  The group members.
  * **`value`** (string) (required)
    The local unique identifier for the member
  * **`displayName`** (string) (required)
    The display name associated with the member

### HTTP response status codes

* **200** - Group was updated

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Group

**Request:**

```curl
curl -L \
  -X PUT \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Group"
  ],
  "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
  "displayName": "Engineering"
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise group](#provision-a-scim-enterprise-group).

#### Group with member

**Request:**

```curl
curl -L \
  -X PUT \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Group"
  ],
  "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
  "displayName": "Engineering",
  "members": [
    {
      "value": "879db59-3bdf-4490-ad68-ab880a2694745",
      "displayName": "User 1"
    },
    {
      "value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
      "displayName": "User 2"
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise group](#provision-a-scim-enterprise-group).

## Update an attribute for a SCIM enterprise group

```
PATCH /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Update a provisioned group’s individual attributes.
To change a group’s values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the SCIM specification.  Update can also be used to add group memberships.
Group memberships can be sent one at a time or in batches for faster performance. Note: The memberships are referenced through a local user id, and the user will need to be created before they are referenced here.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_group_id`** (string) (required)
  A unique identifier of the SCIM group.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`Operations`** (array of objects) (required)
  patch operations list
  * **`op`** (string) (required)
    Can be one of: `add`, `replace`, `remove`
  * **`path`** (string)
  * **`value`** (string)
    Corresponding 'value' of that field specified by 'path'

* **`schemas`** (array of strings) (required)
  undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp

### HTTP response status codes

* **200** - Success, group was updated

* **204** - No Content

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Update Group

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "displayName",
      "value": "Employees"
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise group](#provision-a-scim-enterprise-group).

#### Add Members

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "add",
      "path": "members",
      "value": [
        {
          "value": "879db59-3bdf-4490-ad68-ab880a2694745"
        },
        {
          "value": "0db508eb-91e2-46e4-809c-30dcbda0c685"
        }
      ]
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise group](#provision-a-scim-enterprise-group).

## Delete a SCIM group from an enterprise

```
DELETE /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Deletes a SCIM group from an enterprise.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_group_id`** (string) (required)
  A unique identifier of the SCIM group.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **204** - Group was deleted, no content

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X DELETE \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID
```

**Response schema (Status: 204):**

## List SCIM provisioned identities for an enterprise

```
GET /scim/v2/enterprises/{enterprise}/Users
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Lists provisioned SCIM enterprise members.
When a user with a SCIM-provisioned external identity is removed from an enterprise through a patch with active flag set to false, the account's metadata is preserved to allow the user to re-join the enterprise in the future. However, the user's account will be suspended and the user will not be able to sign-in. In order to permanently suspend the users account with no ability to re-join the enterprise in the future, use the delete request. Users that were not permanently deleted will be visible in the returned results.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`filter`** (string)
  If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are userName, externalId, id, and displayName. For example, ?filter=externalId eq "9138790-10932-109120392-12321".

* **`startIndex`** (integer)
  Used for pagination: the starting index of the first result to return when paginating through values.
  Default: `1`

* **`count`** (integer)
  Used for pagination: the number of results to return per page.
  Default: `30`

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **200** - Success, either users were found or not found

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users
```

**Response schema (Status: 200):**

Same response schema as [List provisioned SCIM groups for an enterprise](#list-provisioned-scim-groups-for-an-enterprise).

## Provision a SCIM enterprise user

```
POST /scim/v2/enterprises/{enterprise}/Users
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Creates an external identity for a new SCIM enterprise user.
SCIM does not authenticate users, it only provisions them. The authentication of users is done by SAML. However, when SCIM is enabled, all users need to be provisioned through SCIM before a user can sign in through SAML. The matching of a user to a SCIM provisioned user is done when the SAML assertion is consumed. The user will be matched on SAML response NameID to SCIM userName.
When converting existing enterprise to use SCIM, the user handle (userName) from the SCIM payload will be used to match the provisioned user to an already existing user in the enterprise. Since the new identity record is created for newly provisioned users the matching for those records is done using a user's handle. Currently the matching will be performed to all of the users no matter if they were SAML JIT provisioned or created as local users.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`schemas`** (array of strings) (required)
  The URIs that are used to indicate the namespaces of the SCIM schemas.
  Supported values are: urn:ietf:params:scim:schemas:core:2.0:User

* **`externalId`** (string) (required)
  A unique identifier for the resource as defined by the provisioning client.

* **`active`** (boolean) (required)
  Whether the user active in the IdP.

* **`userName`** (string) (required)
  The username for the user.

* **`name`** (object)
  * **`formatted`** (string)
    The full name, including all middle names, titles, and suffixes as appropriate, formatted for display.
  * **`familyName`** (string) (required)
    The family name of the user.
  * **`givenName`** (string) (required)
    The given name of the user.
  * **`middleName`** (string)
    The middle name(s) of the user.

* **`displayName`** (string) (required)
  A human-readable name for the user.

* **`emails`** (array of objects) (required)
  The emails for the user.
  * **`value`** (string) (required)
    The email address.
  * **`type`** (string) (required)
    The type of email address.
  * **`primary`** (boolean) (required)
    Whether this email address is the primary address.

* **`roles`** (array of objects)
  The roles assigned to the user.
  * **`display`** (string)
  * **`type`** (string)
  * **`value`** (string) (required)
    The role value representing a user role in GitHub.
    Can be one of: `user`, `27d9891d-2c17-4f45-a262-781a0e55c80a`, `guest_collaborator`, `1ebc4a02-e56c-43a6-92a5-02ee09b90824`, `enterprise_owner`, `981df190-8801-4618-a08a-d91f6206c954`, `ba4987ab-a1c3-412a-b58c-360fc407cb10`, `billing_manager`, `0e338b8c-cc7f-498a-928d-ea3470d7e7e3`, `e6be2762-e4ad-4108-b72d-1bbe884a0f91`
  * **`primary`** (boolean)
    Is the role a primary role for the user.

### HTTP response status codes

* **201** - User has been created

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### User

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ],
  "externalId": "E012345",
  "active": true,
  "userName": "E012345",
  "name": {
    "formatted": "Ms. Mona Lisa Octocat",
    "familyName": "Octocat",
    "givenName": "Mona",
    "middleName": "Lisa"
  },
  "displayName": "Mona Lisa",
  "emails": [
    {
      "value": "mlisa@example.com",
      "type": "work",
      "primary": true
    }
  ],
  "roles": [
    {
      "value": "user",
      "primary": false
    }
  ]
}'
```

**Response schema (Status: 201):**

* all of:
  * **object**
    * `schemas`: required, array of string, enum: `urn:ietf:params:scim:schemas:core:2.0:User`
    * `externalId`: string or null
    * `active`: required, boolean
    * `userName`: string
    * `name`: object:
      * `formatted`: string
      * `familyName`: string
      * `givenName`: string
      * `middleName`: string
    * `displayName`: string or null
    * `emails`: required, array of objects:
      * `value`: required, string
      * `type`: string
      * `primary`: boolean
    * `roles`: array of objects:
      * `display`: string
      * `type`: string
      * `value`: required, string, enum: `user`, `27d9891d-2c17-4f45-a262-781a0e55c80a`, `guest_collaborator`, `1ebc4a02-e56c-43a6-92a5-02ee09b90824`, `enterprise_owner`, `981df190-8801-4618-a08a-d91f6206c954`, `ba4987ab-a1c3-412a-b58c-360fc407cb10`, `billing_manager`, `0e338b8c-cc7f-498a-928d-ea3470d7e7e3`, `e6be2762-e4ad-4108-b72d-1bbe884a0f91`
      * `primary`: boolean
  * **object**
    * `id`: required, string
    * `groups`: array of objects:
      * `value`: string
      * `$ref`: string
      * `display`: string
    * `meta`: required, object:
      * `resourceType`: required, string, enum: `User`, `Group`
      * `created`: string
      * `lastModified`: string
      * `location`: string

#### Enterprise Owner

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ],
  "externalId": "E012345",
  "active": true,
  "userName": "E012345",
  "name": {
    "formatted": "Ms. Mona Lisa Octocat",
    "familyName": "Octocat",
    "givenName": "Mona",
    "middleName": "Lisa"
  },
  "displayName": "Mona Lisa",
  "emails": [
    {
      "value": "mlisa@example.com",
      "type": "work",
      "primary": true
    }
  ],
  "roles": [
    {
      "value": "enterprise_owner",
      "primary": false
    }
  ]
}'
```

**Response schema (Status: 201):**

* all of:
  * **object**
    * `schemas`: required, array of string, enum: `urn:ietf:params:scim:schemas:core:2.0:User`
    * `externalId`: string or null
    * `active`: required, boolean
    * `userName`: string
    * `name`: object:
      * `formatted`: string
      * `familyName`: string
      * `givenName`: string
      * `middleName`: string
    * `displayName`: string or null
    * `emails`: required, array of objects:
      * `value`: required, string
      * `type`: string
      * `primary`: boolean
    * `roles`: array of objects:
      * `display`: string
      * `type`: string
      * `value`: required, string, enum: `user`, `27d9891d-2c17-4f45-a262-781a0e55c80a`, `guest_collaborator`, `1ebc4a02-e56c-43a6-92a5-02ee09b90824`, `enterprise_owner`, `981df190-8801-4618-a08a-d91f6206c954`, `ba4987ab-a1c3-412a-b58c-360fc407cb10`, `billing_manager`, `0e338b8c-cc7f-498a-928d-ea3470d7e7e3`, `e6be2762-e4ad-4108-b72d-1bbe884a0f91`
      * `primary`: boolean
  * **object**
    * `id`: required, string
    * `groups`: array of objects:
      * `value`: string
      * `$ref`: string
      * `display`: string
    * `meta`: required, object:
      * `resourceType`: required, string, enum: `User`, `Group`
      * `created`: string
      * `lastModified`: string
      * `location`: string

## Get SCIM provisioning information for an enterprise user

```
GET /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Gets information about a SCIM user.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_user_id`** (string) (required)
  The unique identifier of the SCIM user.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **200** - Success, a user was found

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise user](#provision-a-scim-enterprise-user).

## Set SCIM information for a provisioned enterprise user

```
PUT /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Replaces an existing provisioned user's information.
You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the Update an attribute for a SCIM user endpoint instead.
Warning

Setting active: false will suspend a user and obfuscate the user handle and user email. Since the implementation is a generic SCIM implementation and does not differentiate yet between different IdP providers, for Okta, the user GDPR data will not be purged and the credentials will not be removed.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_user_id`** (string) (required)
  The unique identifier of the SCIM user.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`schemas`** (array of strings) (required)
  The URIs that are used to indicate the namespaces of the SCIM schemas.
  Supported values are: urn:ietf:params:scim:schemas:core:2.0:User

* **`externalId`** (string) (required)
  A unique identifier for the resource as defined by the provisioning client.

* **`active`** (boolean) (required)
  Whether the user active in the IdP.

* **`userName`** (string) (required)
  The username for the user.

* **`name`** (object)
  * **`formatted`** (string)
    The full name, including all middle names, titles, and suffixes as appropriate, formatted for display.
  * **`familyName`** (string) (required)
    The family name of the user.
  * **`givenName`** (string) (required)
    The given name of the user.
  * **`middleName`** (string)
    The middle name(s) of the user.

* **`displayName`** (string) (required)
  A human-readable name for the user.

* **`emails`** (array of objects) (required)
  The emails for the user.
  * **`value`** (string) (required)
    The email address.
  * **`type`** (string) (required)
    The type of email address.
  * **`primary`** (boolean) (required)
    Whether this email address is the primary address.

* **`roles`** (array of objects)
  The roles assigned to the user.
  * **`display`** (string)
  * **`type`** (string)
  * **`value`** (string) (required)
    The role value representing a user role in GitHub.
    Can be one of: `user`, `27d9891d-2c17-4f45-a262-781a0e55c80a`, `guest_collaborator`, `1ebc4a02-e56c-43a6-92a5-02ee09b90824`, `enterprise_owner`, `981df190-8801-4618-a08a-d91f6206c954`, `ba4987ab-a1c3-412a-b58c-360fc407cb10`, `billing_manager`, `0e338b8c-cc7f-498a-928d-ea3470d7e7e3`, `e6be2762-e4ad-4108-b72d-1bbe884a0f91`
  * **`primary`** (boolean)
    Is the role a primary role for the user.

### HTTP response status codes

* **200** - User was updated

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### User

**Request:**

```curl
curl -L \
  -X PUT \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ],
  "externalId": "E012345",
  "active": true,
  "userName": "E012345",
  "name": {
    "formatted": "Ms. Mona Lisa Octocat",
    "familyName": "Octocat",
    "givenName": "Mona",
    "middleName": "Lisa"
  },
  "displayName": "Mona Lisa",
  "emails": [
    {
      "value": "mlisa@example.com",
      "type": "work",
      "primary": true
    }
  ],
  "roles": [
    {
      "value": "user",
      "primary": false
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise user](#provision-a-scim-enterprise-user).

## Update an attribute for a SCIM enterprise user

```
PATCH /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Update a provisioned user's individual attributes.
To change a user's values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the SCIM specification.
Note

Complicated SCIM path selectors that include filters are not supported. For example, a path selector defined as "path": "emails\[type eq "work"]" will not work.

Warning

Setting active: false will suspend a user and obfuscate the user handle and user email. Since the implementation is a generic SCIM implementation and does not differentiate yet between different IdP providers (Okta, for example), the user GDPR data in the SCIM metadata will not be purged and the credentials will not be removed.
{
"Operations":\[{
"op":"replace",
"value":{
"active":false
}
}]
}

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_user_id`** (string) (required)
  The unique identifier of the SCIM user.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

#### Body parameters

* **`Operations`** (array of objects) (required)
  patch operations list
  * **`op`** (string) (required)
    Can be one of: `add`, `replace`, `remove`
  * **`path`** (string)
  * **`value`** (string)
    Corresponding 'value' of that field specified by 'path'

* **`schemas`** (array of strings) (required)
  undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp

### HTTP response status codes

* **200** - Success, user was updated

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **409** - Duplicate record detected

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Multi Valued Property

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "emails[type eq 'work'].value",
      "value": "updatedEmail@microsoft.com"
    },
    {
      "op": "replace",
      "path": "name.familyName",
      "value": "updatedFamilyName"
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise user](#provision-a-scim-enterprise-user).

#### Single Valued Property

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "userName",
      "value": "5b50642d-79fc-4410-9e90-4c077cdd1a59@testuser.com"
    },
    {
      "op": "replace",
      "path": "displayName",
      "value": "Monalisa Octocat"
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise user](#provision-a-scim-enterprise-user).

#### Disable User

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "active",
      "value": false
    }
  ]
}'
```

**Response schema (Status: 200):**

Same response schema as [Provision a SCIM enterprise user](#provision-a-scim-enterprise-user).

## Delete a SCIM user from an enterprise

```
DELETE /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
```

Note

The SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

Permanently suspends a SCIM user from an enterprise, removes all data for the user, obfuscates the login, email, and display name of the user, removes all external-identity SCIM attributes, and deletes the emails, avatar, PATs, SSH keys, OAuth authorizations credentials, GPG keys, and SAML mappings for the user. You will not be able to undo this action.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`scim_user_id`** (string) (required)
  The unique identifier of the SCIM user.

* **`enterprise`** (string) (required)
  The slug version of the enterprise name.

### HTTP response status codes

* **204** - User was deleted, no content

* **400** - Bad request

* **401** - Authorization failure

* **403** - Permission denied

* **404** - Resource not found

* **429** - Too many requests

* **500** - Internal server error

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X DELETE \
  http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID
```

**Response schema (Status: 204):**