# 엔터프라이즈 팀을 위한 REST API 엔드포인트

REST API를 사용하여 GitHub 엔터프라이즈에 엔터프라이즈 팀을 만들고 관리할 수 있습니다.

## 엔터프라이즈 팀 정보

이러한 엔드포인트는 personal access tokens classic을 사용하고, `GET` API에는 `read:enterprise`[scope](/ko/enterprise-server@3.20/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps)를, 기타 API에는 `admin:enterprise`를 사용하는 엔터프라이즈 팀이 속한 엔터프라이즈의 인증된 멤버만 사용할 수 있습니다.

이러한 엔드포인트는 fine-grained personal access tokens 또는 GitHub 앱 액세스 토큰과 호환되지 않습니다.

GitHub는 팀 `name`에서 엔터프라이즈 팀의 `slug`를 생성하고 `ent:` 접두사를 추가합니다.

> \[!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 enterprise teams

```
GET /enterprises/{enterprise}/teams
```

List all teams in the enterprise for the authenticated 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.

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **403** - Forbidden

### Code examples

#### Example

**Request:**

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

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

Array of `Enterprise Team`:

* `id`: required, integer, format: int64
* `name`: required, string
* `description`: string
* `slug`: required, string
* `url`: required, string, format: uri
* `sync_to_organizations`: string
* `organization_selection_type`: string
* `group_id`: required, string or null
* `group_name`: string or null
* `html_url`: required, string, format: uri
* `members_url`: required, string
* `created_at`: required, string, format: date-time
* `updated_at`: required, string, format: date-time
* `notification_setting`: string, enum: `notifications_enabled`, `notifications_disabled`

## Create an enterprise team

```
POST /enterprises/{enterprise}/teams
```

To create an enterprise team, the authenticated user must be an owner of the enterprise.

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

* **`name`** (string) (required)
  The name of the team.

* **`description`** (string or null)
  A description of the team.

* **`sync_to_organizations`** (string)
  Retired: this field is no longer supported.
  Whether the enterprise team should be reflected in each organization.
  This value cannot be set.
  Default: `disabled`
  Can be one of: `all`, `disabled`

* **`organization_selection_type`** (string)
  Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all.
  disabled: The team is not assigned to any organizations. This is the default when you create a new team.
  selected: The team is assigned to specific organizations. You can then use the add organization assignments API endpoint.
  all: The team is assigned to all current and future organizations in the enterprise.
  Default: `disabled`
  Can be one of: `disabled`, `selected`, `all`

* **`group_id`** (string or null)
  The ID of the IdP group to assign team membership with. You can get this value from the REST API endpoints for SCIM.

* **`notification_setting`** (string)
  The notification setting the team is set to. The options are:

notifications\_enabled - team members receive notifications when the team is @mentioned.
notifications\_disabled - no one receives notifications.

Default: notifications\_enabled
Can be one of: `notifications_enabled`, `notifications_disabled`

### HTTP response status codes

* **201** - Created

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams \
  -d '{
  "name": "Justice League",
  "description": "A great team.",
  "group_id": "62ab9291-fae2-468e-974b-7e45096d5021"
}'
```

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

* `id`: required, integer, format: int64
* `name`: required, string
* `description`: string
* `slug`: required, string
* `url`: required, string, format: uri
* `sync_to_organizations`: string
* `organization_selection_type`: string
* `group_id`: required, string or null
* `group_name`: string or null
* `html_url`: required, string, format: uri
* `members_url`: required, string
* `created_at`: required, string, format: date-time
* `updated_at`: required, string, format: date-time
* `notification_setting`: string, enum: `notifications_enabled`, `notifications_disabled`

## Get an enterprise team

```
GET /enterprises/{enterprise}/teams/{team_slug}
```

Gets a team using the team's slug. To create the slug, GitHub replaces special characters in the name string, changes all words to lowercase, and replaces spaces with a - separator and adds the "ent:" prefix. For example, "My TEam Näme" would become ent:my-team-name.

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

* **`team_slug`** (string) (required)
  The slug of the team name.

### HTTP response status codes

* **200** - OK

* **403** - Forbidden

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG
```

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

Same response schema as [Create an enterprise team](#create-an-enterprise-team).

## Update an enterprise team

```
PATCH /enterprises/{enterprise}/teams/{team_slug}
```

To edit a team, the authenticated user must be an enterprise owner.

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

* **`team_slug`** (string) (required)
  The slug of the team name.

#### Body parameters

* **`name`** (string or null)
  A new name for the team.

* **`description`** (string or null)
  A new description for the team.

* **`sync_to_organizations`** (string)
  Retired: this field is no longer supported.
  Whether the enterprise team should be reflected in each organization.
  This value cannot be changed.
  Default: `disabled`
  Can be one of: `all`, `disabled`

* **`organization_selection_type`** (string)
  Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all.
  disabled: The team is not assigned to any organizations. This is the default when you create a new team.
  selected: The team is assigned to specific organizations. You can then use the add organization assignments API.
  all: The team is assigned to all current and future organizations in the enterprise.
  Default: `disabled`
  Can be one of: `disabled`, `selected`, `all`

* **`group_id`** (string or null)
  The ID of the IdP group to assign team membership with. The new IdP group will replace the existing one, or replace existing direct members if the team isn't currently linked to an IdP group.

* **`notification_setting`** (string)
  The notification setting the team is set to. The options are:

notifications\_enabled - team members receive notifications when the team is @mentioned.
notifications\_disabled - no one receives notifications.
Can be one of: `notifications_enabled`, `notifications_disabled`

### HTTP response status codes

* **200** - OK

* **403** - Forbidden

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG \
  -d '{
  "name": "Justice League",
  "description": "A great team.",
  "group_id": "62ab9291-fae2-468e-974b-7e45096d5021"
}'
```

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

Same response schema as [Create an enterprise team](#create-an-enterprise-team).

## Delete an enterprise team

```
DELETE /enterprises/{enterprise}/teams/{team_slug}
```

To delete an enterprise team, the authenticated user must be an enterprise owner.
If you are an enterprise owner, deleting an enterprise team will delete all of its IdP mappings as well.

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

* **`team_slug`** (string) (required)
  The slug of the team name.

### HTTP response status codes

* **204** - No Content

* **403** - Forbidden

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X DELETE \
  http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG
```

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