# Update a team (Legacy)

From **GitHub v3 REST API**.

`PATCH /teams/{team_id}`

**Deprecated.**

**Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/enterprise-server@3.0/rest/reference/teams#update-a-team) endpoint.

To edit a team, the authenticated user must either be an organization owner or a team maintainer.

**Note:** With nested teams, the `privacy` for parent teams cannot be `secret`.

## Parameters

### `team_id`

- Location: path
- Required: true
- Type: `integer`

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "description": "new team description",
  "name": "new team name",
  "privacy": "closed"
}
```

```json
{"properties":{"description":{"description":"The description of the team.","type":"string"},"name":{"description":"The name of the team.","type":"string"},"parent_team_id":{"description":"The ID of a team to set as the parent team.","nullable":true,"type":"integer"},"permission":{"default":"pull","description":"**Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of:  \n\\* `pull` - team members can pull, but not push to or administer newly-added repositories.  \n\\* `push` - team members can pull and push, but not administer newly-added repositories.  \n\\* `admin` - team members can pull, push and administer newly-added repositories.","enum":["pull","push","admin"],"type":"string"},"privacy":{"description":"The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. The options are:  \n**For a non-nested team:**  \n\\* `secret` - only visible to organization owners and members of this team.  \n\\* `closed` - visible to all members of this organization.  \n**For a parent or child team:**  \n\\* `closed` - visible to all members of this organization.","enum":["secret","closed"],"type":"string"}},"required":["name"],"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Groups of organization members that gives permissions on specified repositories.

```json
{
  "created_at": "2017-07-14T16:53:42Z",
  "description": "A great team.",
  "html_url": "https://github.com/orgs/github/teams/justice-league",
  "id": 1,
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com",
  "members_count": 3,
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "name": "Justice League",
  "node_id": "MDQ6VGVhbTE=",
  "organization": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "blog": "https://github.com/blog",
    "company": "GitHub",
    "created_at": "2008-01-14T04:33:35Z",
    "description": "A great organization",
    "email": "octocat@github.com",
    "events_url": "https://api.github.com/orgs/github/events",
    "followers": 20,
    "following": 0,
    "has_organization_projects": true,
    "has_repository_projects": true,
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "html_url": "https://github.com/octocat",
    "id": 1,
    "issues_url": "https://api.github.com/orgs/github/issues",
    "location": "San Francisco",
    "login": "github",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "name": "github",
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "public_gists": 1,
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "public_repos": 2,
    "repos_url": "https://api.github.com/orgs/github/repos",
    "type": "Organization",
    "updated_at": "2017-08-17T12:37:15Z",
    "url": "https://api.github.com/orgs/github"
  },
  "permission": "admin",
  "privacy": "closed",
  "repos_count": 10,
  "repositories_url": "https://api.github.com/teams/1/repos",
  "slug": "justice-league",
  "updated_at": "2017-08-17T12:37:15Z",
  "url": "https://api.github.com/teams/1"
}
```

```json
{"description":"Groups of organization members that gives permissions on specified repositories.","properties":{"created_at":{"example":"2017-07-14T16:53:42Z","format":"date-time","type":"string"},"description":{"example":"A great team.","nullable":true,"type":"string"},"html_url":{"example":"https://github.com/orgs/rails/teams/core","format":"uri","type":"string"},"id":{"description":"Unique identifier of the team","example":42,"type":"integer"},"ldap_dn":{"description":"Distinguished Name (DN) that team maps to within LDAP environment","example":"uid=example,ou=users,dc=github,dc=com","type":"string"},"members_count":{"example":3,"type":"integer"},"members_url":{"example":"https://api.github.com/organizations/1/team/1/members{/member}","type":"string"},"name":{"description":"Name of the team","example":"Developers","type":"string"},"node_id":{"example":"MDQ6VGVhbTE=","type":"string"},"organization":{"$ref":"#/components/schemas/organization-full"},"parent":{"$ref":"#/components/schemas/nullable-team-simple"},"permission":{"description":"Permission that the team will have for its repositories","example":"push","type":"string"},"privacy":{"description":"The level of privacy this team should have","enum":["closed","secret"],"example":"closed","type":"string"},"repos_count":{"example":10,"type":"integer"},"repositories_url":{"example":"https://api.github.com/organizations/1/team/1/repos","format":"uri","type":"string"},"slug":{"example":"justice-league","type":"string"},"updated_at":{"example":"2017-08-17T12:37:15Z","format":"date-time","type":"string"},"url":{"description":"URL for the team","example":"https://api.github.com/organizations/1/team/1","format":"uri","type":"string"}},"required":["id","node_id","url","members_url","name","description","permission","html_url","repositories_url","slug","created_at","updated_at","members_count","repos_count","organization"],"title":"Full Team","type":"object"}
```

### `201`

Response

### `application/json`

- Type: `object`

Groups of organization members that gives permissions on specified repositories.

```json
{
  "created_at": "2017-07-14T16:53:42Z",
  "description": "A great team.",
  "html_url": "https://github.com/orgs/github/teams/justice-league",
  "id": 1,
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com",
  "members_count": 3,
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "name": "Justice League",
  "node_id": "MDQ6VGVhbTE=",
  "organization": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "blog": "https://github.com/blog",
    "company": "GitHub",
    "created_at": "2008-01-14T04:33:35Z",
    "description": "A great organization",
    "email": "octocat@github.com",
    "events_url": "https://api.github.com/orgs/github/events",
    "followers": 20,
    "following": 0,
    "has_organization_projects": true,
    "has_repository_projects": true,
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "html_url": "https://github.com/octocat",
    "id": 1,
    "issues_url": "https://api.github.com/orgs/github/issues",
    "location": "San Francisco",
    "login": "github",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "name": "github",
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "public_gists": 1,
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "public_repos": 2,
    "repos_url": "https://api.github.com/orgs/github/repos",
    "type": "Organization",
    "updated_at": "2017-08-17T12:37:15Z",
    "url": "https://api.github.com/orgs/github"
  },
  "permission": "admin",
  "privacy": "closed",
  "repos_count": 10,
  "repositories_url": "https://api.github.com/teams/1/repos",
  "slug": "justice-league",
  "updated_at": "2017-08-17T12:37:15Z",
  "url": "https://api.github.com/teams/1"
}
```

```json
{"description":"Groups of organization members that gives permissions on specified repositories.","properties":{"created_at":{"example":"2017-07-14T16:53:42Z","format":"date-time","type":"string"},"description":{"example":"A great team.","nullable":true,"type":"string"},"html_url":{"example":"https://github.com/orgs/rails/teams/core","format":"uri","type":"string"},"id":{"description":"Unique identifier of the team","example":42,"type":"integer"},"ldap_dn":{"description":"Distinguished Name (DN) that team maps to within LDAP environment","example":"uid=example,ou=users,dc=github,dc=com","type":"string"},"members_count":{"example":3,"type":"integer"},"members_url":{"example":"https://api.github.com/organizations/1/team/1/members{/member}","type":"string"},"name":{"description":"Name of the team","example":"Developers","type":"string"},"node_id":{"example":"MDQ6VGVhbTE=","type":"string"},"organization":{"$ref":"#/components/schemas/organization-full"},"parent":{"$ref":"#/components/schemas/nullable-team-simple"},"permission":{"description":"Permission that the team will have for its repositories","example":"push","type":"string"},"privacy":{"description":"The level of privacy this team should have","enum":["closed","secret"],"example":"closed","type":"string"},"repos_count":{"example":10,"type":"integer"},"repositories_url":{"example":"https://api.github.com/organizations/1/team/1/repos","format":"uri","type":"string"},"slug":{"example":"justice-league","type":"string"},"updated_at":{"example":"2017-08-17T12:37:15Z","format":"date-time","type":"string"},"url":{"description":"URL for the team","example":"https://api.github.com/organizations/1/team/1","format":"uri","type":"string"}},"required":["id","node_id","url","members_url","name","description","permission","html_url","repositories_url","slug","created_at","updated_at","members_count","repos_count","organization"],"title":"Full Team","type":"object"}
```

### `403`

Forbidden

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request PATCH \
  --url {protocol}://{hostname}/api/v3/teams/{team_id} \
  --header 'content-type: application/json' \
  --data '{
  "description": "new team description",
  "name": "new team name",
  "privacy": "closed"
}'
```
