# SCIM 的 REST API 端点

使用 REST API 通过 SCIM 自动创建用户和团队成员身份。

## 关于 SCIM

> \[!NOTE]
> 这些终结点仅支持使用 personal access token (classic) 进行身份验证。 有关详细信息，请参阅“[管理个人访问令牌](/zh/enterprise-server@3.22/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)”。

GitHub 提供供支持 SCIM 的身份提供程序 (IdP) 使用的端点。 IdP 上的集成可以使用 REST API 在使用 SAML 单一登录（SSO）进行身份验证的实例上 GitHub Enterprise Server 自动预配、管理或取消预配用户帐户。 请参阅“[关于在 GitHub Enterprise Server 上使用 SCIM 进行用户预配](/zh/enterprise-server@3.22/admin/managing-iam/provisioning-user-accounts-with-scim/user-provisioning-with-scim-on-ghes)”。

这些终结点基于 SCIM 2.0。 有关详细信息，请参阅 IdP 的文档，或者参阅 [IETF 网站上的规范](https://datatracker.ietf.org/doc/html/rfc7644)。

### 根 URL

IdP 可以使用以下根 URL 来与实例的此类别 GitHub Enterprise Server 中的终结点通信。

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

**请勿**将以下终结点文档中所提供的 URL 的 `enterprises/{enterprise}/` 部分包含在内。 路径的此部分不适用于 GitHub Enterprise Server。 未来，本文档将显示适用于 GitHub Enterprise Server 的正确 URL。

此类别中的终结点区分大小写。 例如，`Users` 终结点中的第一个字母必须大写。

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

### 身份验证

IdP 上的 SCIM 集成代表 GitHub Enterprise Server 实例的企业所有者执行操作。 有关详细信息，请参阅“[企业中角色的能力](/zh/enterprise-server@3.22/admin/managing-accounts-and-repositories/managing-roles-in-your-enterprise/abilities-of-roles#enterprise-owners)”。

若要对 API 请求进行身份验证，在 IdP 上配置 SCIM 的人员必须使用personal access token (classic)`scim:enterprise`范围，IdP 必须在请求的`Authorization`标头中提供该范围。 有关 personal access tokens (classic) 的详细信息，请参阅 [管理个人访问令牌](/zh/enterprise-server@3.22/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)。

> \[!NOTE]
> 企业所有者必须生成并使用 personal access token (classic)，以对发往此类别中各端点的请求进行身份验证。               目前不支持 Fine-grained personal access token 和 GitHub App 调用方。

### SAML 和 SCIM 数据的映射

GitHub Enterprise Server用户使用 SAML SSO 成功进行身份验证后，GitHub将用户链接到 SCIM 预配的标识。 要成功链接标识，SAML 标识提供者和 SCIM 集成必须使用匹配的唯一标识符。

当用户的 SAML 与 SCIM 数据不匹配时，将返回一个错误， GitHub 指出 SAML 和 SCIM 中的哪些属性不匹配。 有关此错误的详细信息，请参阅 [排除企业的标识和访问管理故障](/zh/enterprise-server@3.22/admin/managing-iam/understanding-iam-for-enterprises/troubleshooting-identity-and-access-management-for-your-enterprise#saml-and-scim-data-mismatch-errors)。

GitHub 需要以下 SAML 声明和 SCIM 属性才能成功地将用户与 SCIM 预配的标识匹配。 标识提供者在用于唯一标识用户的字段中可能有所不同。

#### 将 Microsoft Entra ID 用于 SAML

若要对 SAML 使用 Entra ID（以前称为 Azure AD），以下 SAML 声明和 SCIM 属性必须匹配。

| SAML 声明                                                         | 匹配的 SCIM 属性  |
| :-------------------------------------------------------------- | :----------- |
| `http://schemas.microsoft.com/identity/claims/objectidentifier` | `externalId` |

#### 用于 SAML 的其他 IDP

若要对 SAML 使用其他 IdP， GitHub 请使用 SAML“用户属性”中配置的“用户名”属性，以便与下面列出的 SCIM 属性匹配。 如果留空，SAML“用户属性”中的“用户名”属性将会默认设置为 SAML `NameID`。 有关 SAML 配置的详细信息，请参阅 [为企业配置 SAML 单点登录](/zh/enterprise-server@3.22/admin/managing-iam/using-saml-for-enterprise-iam/configuring-saml-single-sign-on-for-your-enterprise#configuring-saml-sso)。

| SAML 声明                                                | 匹配的 SCIM 属性 |
| :----------------------------------------------------- | :---------- |
| SAML“User attributes”中配置的“Username”属性；如果留空，则为 `NameID` | `userName`  |

### 支持的 SCIM 用户属性

此类别中的 `User` 终结点支持在请求参数中使用以下属性。

| 名称                | 类型  | 说明                                                                                                                                                                                         |
| :---------------- | :-- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `displayName`     | 字符串 | 用户的易读名称。                                                                                                                                                                                   |
| `name.formatted`  | 字符串 | 用户的全名，包括所有中间名、称谓和后缀，经过格式化以便显示。                                                                                                                                                             |
| `name.givenName`  | 字符串 | 用户的名字。                                                                                                                                                                                     |
| `name.familyName` | 字符串 | 用户的姓氏。                                                                                                                                                                                     |
| `userName`        | 字符串 | 由 IdP 生成的用户的用户名。 使用前经过[规范化](/zh/enterprise-server@3.22/admin/managing-iam/iam-configuration-reference/username-considerations-for-external-authentication#about-username-normalization)处理。 |
| `emails`          | 数组  | 用户的电子邮件列表。                                                                                                                                                                                 |
| `roles`           | 数组  | 用户角色的列表。                                                                                                                                                                                   |
| `externalId`      | 字符串 | 此标识符由 IdP 提供程序生成。 您可以在 IdP 上查找某个用户的 `externalId`，也可以使用 [列出 SCIM 预配标识](#list-scim-provisioned-identities-for-an-enterprise) 端点，并根据其他已知属性进行筛选，例如该 GitHub Enterprise Server 实例上的用户名或电子邮件地址。   |
| `id`              | 字符串 | 实例的 SCIM 终结点生成的标识符。                                                                                                                                                                        |
| `active`          | 布尔  | 指示身份是处于活动状态 (`true`) 还是应暂停 (`false`)。                                                                                                                                                      |

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. 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):**