Skip to main content

Enterprise Server 3.21 is currently available as a release candidate.

The REST API is now versioned. For more information, see "About API versioning."

REST API endpoints for enterprise team memberships

Use the REST API to create and manage membership of enterprise teams in your GitHub enterprise.

About enterprise team members

Note

These endpoints are currently in public preview and subject to change.

This API documentation is for enterprises on GitHub Enterprise Cloud.

If your enterprise is Copilot Business for non-GHE, please refer to the early access documentation link that was previously shared to you.

These endpoints are only available to authenticated members of the enterprise team's enterprise with classic personal access tokens with the read:enterprise scope for GET APIs and admin:enterprise for other APIs.

These endpoints are not compatible with fine-grained personal access tokens or GitHub App access tokens.

GitHub generates the enterprise team's slug from the team name and adds the ent: prefix.

List members in an enterprise team

Lists all team members in an enterprise team.

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Enterprise teams" enterprise permissions (read)

Parameters for "List members in an enterprise team"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

enterprise-team string Required

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Query parameters
Name, Type, Description
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_status_code

status_codeDescription
200

OK

code_samples

request_example

get/enterprises/{enterprise}/teams/{enterprise-team}/memberships
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships

Response

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false } ]

Bulk add team members

Add multiple team members to an enterprise team.

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Enterprise teams" enterprise permissions (write)

Parameters for "Bulk add team members"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

enterprise-team string Required

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Body parameters
Name, Type, Description
usernames array of strings Required

The GitHub user handles to add to the team.

http_status_code

status_codeDescription
200

Successfully added team members.

code_samples

request_example

post/enterprises/{enterprise}/teams/{enterprise-team}/memberships/add
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships/add \ -d '{"usernames":["monalisa","octocat"]}'

Successfully added team members.

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false } ]

Bulk remove team members

Remove multiple team members from an enterprise team.

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Enterprise teams" enterprise permissions (write)

Parameters for "Bulk remove team members"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

enterprise-team string Required

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Body parameters
Name, Type, Description
usernames array of strings Required

The GitHub user handles to be removed from the team.

http_status_code

status_codeDescription
200

Successfully removed team members.

code_samples

request_example

post/enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships/remove \ -d '{"usernames":["monalisa","octocat"]}'

Successfully removed team members.

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false } ]

Add team member

Add a team member to an enterprise team.

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Enterprise teams" enterprise permissions (write)

Parameters for "Add team member"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

enterprise-team string Required

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

username string Required

The handle for the GitHub user account.

http_status_code

status_codeDescription
201

Successfully added team member

code_samples

request_example

put/enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships/USERNAME

Successfully added team member

Status: 201
{ "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false }

Remove team membership

Remove membership of a specific user from a particular team in an enterprise.

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Enterprise teams" enterprise permissions (write)

Parameters for "Remove team membership"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

enterprise-team string Required

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

username string Required

The handle for the GitHub user account.

http_status_code

status_codeDescription
204

No Content

403

Forbidden

code_samples

request_example

delete/enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships/USERNAME

Response

Status: 204