GitHub v3 REST API

Create a team

To create a team, the authenticated user must be a member or owner of {org}. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see “Setting team creation permissions.”

When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of maintainers. For more information, see “About teams”.

post
{protocol}://{hostname}/api/v3/orgs/{org}/teams

Path Parameters

orgstringrequired

Body

application/json
namestringrequired

The name of the team.

descriptionstring

The description of the team.

maintainersarray[string]

List GitHub IDs for organization members who will become team maintainers.

repo_namesarray[string]

The full name (e.g., “organization-name/repository-name”) of repositories to add the team to.

privacystring

The level of privacy this team should have. The options are:
For a non-nested team:
* secret - only visible to organization owners and members of this team.
* closed - visible to all members of this organization.
Default: secret
For a parent or child team:
* closed - visible to all members of this organization.
Default for child team: closed

Allowed values:secretclosed

permissionstring

Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* pull - team members can pull, but not push to or administer newly-added repositories.
* push - team members can pull and push, but not administer newly-added repositories.

Allowed values:pullpush

Default:pull

parent_team_idinteger

The ID of a team to set as the parent team.

ldap_dnstring

The distinguished name (DN) of the LDAP entry to map to a team. LDAP synchronization must be enabled to map LDAP entries to a team. Use the “Update LDAP mapping for a team” endpoint to change the LDAP DN. For more information, see “Using LDAP.”

Response

application/json

Response

Full Team

Groups of organization members that gives permissions on specified repositories.

idintegerrequired

Unique identifier of the team

Example:42

node_idstringrequired

Example:MDQ6VGVhbTE=

urlstring(uri)required

URL for the team

Example:https://api.github.com/organizations/1/team/1

html_urlstring(uri)required

Example:https://github.com/orgs/rails/teams/core

namestringrequired

Name of the team

Example:Developers

slugstringrequired

Example:justice-league

descriptionstring | nullrequired

Example:A great team.

privacystring

The level of privacy this team should have

Allowed values:closedsecret

Example:closed

permissionstringrequired

Permission that the team will have for its repositories

Example:push

members_urlstringrequired

Example:https://api.github.com/organizations/1/team/1/members{/member}

repositories_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/1/repos

parentobject | null

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
members_countintegerrequired

Example:3

repos_countintegerrequired

Example:10

created_atstring(date-time)required

Example:2017-07-14T16:53:42Z

updated_atstring(date-time)required

Example:2017-08-17T12:37:15Z

organizationobjectrequired

Organization Full

Show Child Parameters
ldap_dnstring

Distinguished Name (DN) that team maps to within LDAP environment

Example:uid=example,ou=users,dc=github,dc=com

post/orgs/{org}/teams

Body

{ "name": "Justice League", "description": "A great team", "permission": "push", "privacy": "closed" }
 
application/json

Get a team by name

Gets a team using the team’s slug. GitHub Enterprise Server generates the slug from the team name.

Note: You can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}.

get
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

Response

application/json

Response

Full Team

Groups of organization members that gives permissions on specified repositories.

idintegerrequired

Unique identifier of the team

Example:42

node_idstringrequired

Example:MDQ6VGVhbTE=

urlstring(uri)required

URL for the team

Example:https://api.github.com/organizations/1/team/1

html_urlstring(uri)required

Example:https://github.com/orgs/rails/teams/core

namestringrequired

Name of the team

Example:Developers

slugstringrequired

Example:justice-league

descriptionstring | nullrequired

Example:A great team.

privacystring

The level of privacy this team should have

Allowed values:closedsecret

Example:closed

permissionstringrequired

Permission that the team will have for its repositories

Example:push

members_urlstringrequired

Example:https://api.github.com/organizations/1/team/1/members{/member}

repositories_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/1/repos

parentobject | null

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
members_countintegerrequired

Example:3

repos_countintegerrequired

Example:10

created_atstring(date-time)required

Example:2017-07-14T16:53:42Z

updated_atstring(date-time)required

Example:2017-08-17T12:37:15Z

organizationobjectrequired

Organization Full

Show Child Parameters
ldap_dnstring

Distinguished Name (DN) that team maps to within LDAP environment

Example:uid=example,ou=users,dc=github,dc=com

get/orgs/{org}/teams/{team_slug}
 
application/json

Update a team

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

Note: You can also specify a team by org_id and team_id using the route PATCH /organizations/{org_id}/team/{team_id}.

patch
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

Body

application/json
namestring

The name of the team.

descriptionstring

The description of the team.

privacystring

The level of privacy this team should have. Editing teams without specifying this parameter leaves privacy intact. When a team is nested, the privacy for parent teams cannot be secret. The options are:
For a non-nested team:
* secret - only visible to organization owners and members of this team.
* closed - visible to all members of this organization.
For a parent or child team:
* closed - visible to all members of this organization.

Allowed values:secretclosed

permissionstring

Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* pull - team members can pull, but not push to or administer newly-added repositories.
* push - team members can pull and push, but not administer newly-added repositories.
* admin - team members can pull, push and administer newly-added repositories.

Allowed values:pullpushadmin

Default:pull

parent_team_idinteger | null

The ID of a team to set as the parent team.

Response

201 application/json

Response

Full Team

Groups of organization members that gives permissions on specified repositories.

idintegerrequired

Unique identifier of the team

Example:42

node_idstringrequired

Example:MDQ6VGVhbTE=

urlstring(uri)required

URL for the team

Example:https://api.github.com/organizations/1/team/1

html_urlstring(uri)required

Example:https://github.com/orgs/rails/teams/core

namestringrequired

Name of the team

Example:Developers

slugstringrequired

Example:justice-league

descriptionstring | nullrequired

Example:A great team.

privacystring

The level of privacy this team should have

Allowed values:closedsecret

Example:closed

permissionstringrequired

Permission that the team will have for its repositories

Example:push

members_urlstringrequired

Example:https://api.github.com/organizations/1/team/1/members{/member}

repositories_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/1/repos

parentobject | null

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
members_countintegerrequired

Example:3

repos_countintegerrequired

Example:10

created_atstring(date-time)required

Example:2017-07-14T16:53:42Z

updated_atstring(date-time)required

Example:2017-08-17T12:37:15Z

organizationobjectrequired

Organization Full

Show Child Parameters
ldap_dnstring

Distinguished Name (DN) that team maps to within LDAP environment

Example:uid=example,ou=users,dc=github,dc=com

patch/orgs/{org}/teams/{team_slug}

Body

{ "name": "new team name", "description": "new team description", "privacy": "closed" }
 
201 application/json

Delete a team

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

If you are an organization owner, deleting a parent team will delete all of its child teams as well.

Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/{org_id}/team/{team_id}.

delete
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

Response

204

Response

delete/orgs/{org}/teams/{team_slug}
 
204

List discussions

List all discussions on a team’s page. OAuth access tokens require the read:discussion scope.

Note: You can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}/discussions.

get
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/discussions

Query Parameters

directionstring

One of asc (ascending) or desc (descending).

Allowed values:ascdesc

Default:desc

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

pinnedstring

Pinned discussions only filter

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

Response

200 application/json

Response

A team discussion is a persistent record of a free-form conversation within a team.

authorobject | nullrequired

Simple User

Show Child Parameters
bodystringrequired

The main text of the discussion.

Example:Please suggest improvements to our workflow in comments.

body_htmlstringrequired

Example:<p>Hi! This is an area for us to collaborate as a team</p>

body_versionstringrequired

The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server.

Example:0307116bbf7ced493b8d8a346c650b71

comments_countintegerrequired

Example:0

comments_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/2343027/discussions/1/comments

created_atstring(date-time)required

Example:2018-01-25T18:56:31Z

last_edited_atstring | null(date-time)required
html_urlstring(uri)required

Example:https://github.com/orgs/github/teams/justice-league/discussions/1

node_idstringrequired

Example:MDE0OlRlYW1EaXNjdXNzaW9uMQ==

numberintegerrequired

The unique sequence number of a team discussion.

Example:42

pinnedbooleanrequired

Whether or not this discussion should be pinned for easy retrieval.

Example:true

privatebooleanrequired

Whether or not this discussion should be restricted to team members and organization administrators.

Example:true

team_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/2343027

titlestringrequired

The title of the discussion.

Example:How can we improve our workflow?

updated_atstring(date-time)required

Example:2018-01-25T18:56:31Z

urlstring(uri)required

Example:https://api.github.com/organizations/1/team/2343027/discussions/1

reactionsobject
Show Child Parameters
get/orgs/{org}/teams/{team_slug}/discussions
 
200 application/json