GitHub Enterprise Enterprise Team Memberships API

Endpoints to manage GitHub Enterprise Team memberships.

Operations 7

GET /enterprises/{enterprise}/members/{username}/teams List enterprise teams for a user #
GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships List members in an enterprise team #
POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add Bulk add team members #
POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove Bulk remove team members #
GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} Get enterprise team membership #
PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} Add team member #
DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} Remove team membership #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/github-enterprise:github-enterprise-enterprise-team-memberships-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

github-enterprise-enterprise-team-memberships-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Github Enterprise Enterprise Team Memberships API
  version: 1.1.4
  contact:
    name: Support
    url: https://support.github.com/contact?tags=dotcom-rest-api
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  termsOfService: https://docs.github.com/articles/github-terms-of-service
  x-github-plan: ghec
  description: 'Operations tagged enterprise-team-memberships across 2 of this provider''s published API definitions: github-enterprise-ghec-openapi.json, github-enterprise-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.github.com
tags:
- name: enterprise-team-memberships
  description: Endpoints to manage GitHub Enterprise Team memberships.
paths:
  /enterprises/{enterprise}/members/{username}/teams:
    get:
      summary: List enterprise teams for a user
      description: 'Lists all enterprise teams that a user is a member of. This endpoint is available only for

        enterprises using the new enterprise teams experience.


        The authenticated user must be an enterprise owner or have the `enterprise_teams:read` permission.'
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/list-teams-for-user
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#list-enterprise-teams-for-a-user
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/username'
      - $ref: '#/components/parameters/per-page'
      - $ref: '#/components/parameters/page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/enterprise-team'
              examples:
                default:
                  $ref: '#/components/examples/enterprise-teams-items'
          headers:
            Link:
              $ref: '#/components/headers/link'
        '401':
          $ref: '#/components/responses/requires_authentication'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/not_found'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    servers:
    - url: https://api.github.com
  /enterprises/{enterprise}/teams/{enterprise-team}/memberships:
    get:
      summary: List members in an enterprise team
      description: Lists all team members in an enterprise team.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/list
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#list-members-in-an-enterprise-team
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      - $ref: '#/components/parameters/per-page'
      - $ref: '#/components/parameters/page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/simple-user'
              examples:
                default:
                  $ref: '#/components/examples/simple-user-items'
          headers:
            Link:
              $ref: '#/components/headers/link'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    servers:
    - url: https://api.github.com
  /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add:
    post:
      summary: Bulk add team members
      description: Add multiple team members to an enterprise team.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/bulk-add
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#bulk-add-team-members
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - usernames
              properties:
                usernames:
                  type: array
                  description: The GitHub user handles to add to the team.
                  items:
                    type: string
                    description: The handle for the GitHub user account.
            examples:
              default:
                value:
                  usernames:
                  - monalisa
                  - octocat
      responses:
        '200':
          description: Successfully added team members.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/simple-user'
              examples:
                default:
                  $ref: '#/components/examples/simple-user-items'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    servers:
    - url: https://api.github.com
  /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove:
    post:
      summary: Bulk remove team members
      description: Remove multiple team members from an enterprise team.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/bulk-remove
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#bulk-remove-team-members
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - usernames
              properties:
                usernames:
                  type: array
                  description: The GitHub user handles to be removed from the team.
                  items:
                    type: string
                    description: The handle for the GitHub user account.
            examples:
              default:
                value:
                  usernames:
                  - monalisa
                  - octocat
      responses:
        '200':
          description: Successfully removed team members.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/simple-user'
              examples:
                default:
                  $ref: '#/components/examples/simple-user-items'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    servers:
    - url: https://api.github.com
  /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}:
    get:
      summary: Get enterprise team membership
      description: Returns whether the user is a member of the enterprise team.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/get
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#get-enterprise-team-membership
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      - $ref: '#/components/parameters/username'
      responses:
        '200':
          description: User is a member of the enterprise team.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/simple-user'
              examples:
                exampleKey1:
                  $ref: '#/components/examples/simple-user'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    put:
      summary: Add team member
      description: Add a team member to an enterprise team.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/add
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#add-team-member
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      - $ref: '#/components/parameters/username'
      responses:
        '201':
          description: Successfully added team member
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/simple-user'
              examples:
                exampleKey1:
                  $ref: '#/components/examples/simple-user'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    delete:
      summary: Remove team membership
      description: Remove membership of a specific user from a particular team in an enterprise.
      tags:
      - enterprise-team-memberships
      operationId: enterprise-team-memberships/remove
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-teams/enterprise-team-members#remove-team-membership
      parameters:
      - $ref: '#/components/parameters/enterprise'
      - $ref: '#/components/parameters/enterprise-team'
      - $ref: '#/components/parameters/username'
      responses:
        '204':
          description: Response
        '403':
          $ref: '#/components/responses/forbidden'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: false
        category: enterprise-teams
        subcategory: enterprise-team-members
    servers:
    - url: https://api.github.com
components:
  headers:
    link:
      example: <https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"
      schema:
        type: string
  responses:
    forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
    requires_authentication:
      description: Requires authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
    not_found:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
  parameters:
    page:
      name: page
      description: The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/enterprise-cloud@latest/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
      in: query
      schema:
        type: integer
        default: 1
    enterprise:
      name: enterprise
      description: The slug version of the enterprise name.
      in: path
      required: true
      schema:
        type: string
    username:
      name: username
      description: The handle for the GitHub user account.
      in: path
      required: true
      schema:
        type: string
    per-page:
      name: per_page
      description: The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/enterprise-cloud@latest/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
      in: query
      schema:
        type: integer
        default: 30
    enterprise-team:
      name: enterprise-team
      description: The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.
      in: path
      required: true
      schema:
        type: string
  examples:
    simple-user-items:
      value:
      - login: octocat
        id: 1
        node_id: MDQ6VXNlcjE=
        avatar_url: https://github.com/images/error/octocat_happy.gif
        gravatar_id: ''
        url: https://api.github.com/users/octocat
        html_url: https://github.com/octocat
        followers_url: https://api.github.com/users/octocat/followers
        following_url: https://api.github.com/users/octocat/following{/other_user}
        gists_url: https://api.github.com/users/octocat/gists{/gist_id}
        starred_url: https://api.github.com/users/octocat/starred{/owner}{/repo}
        subscriptions_url: https://api.github.com/users/octocat/subscriptions
        organizations_url: https://api.github.com/users/octocat/orgs
        repos_url: https://api.github.com/users/octocat/repos
        events_url: https://api.github.com/users/octocat/events{/privacy}
        received_events_url: https://api.github.com/users/octocat/received_events
        type: User
        site_admin: false
    enterprise-teams-items:
      value:
      - id: 1
        name: Justice League
        description: A great team.
        slug: justice-league
        url: https://api.github.com/enterprises/dc/teams/justice-league
        group_id: 62ab9291-fae2-468e-974b-7e45096d5021
        html_url: https://github.com/enterprises/dc/teams/justice-league
        members_url: https://api.github.com/enterprises/dc/teams/justice-league/members{/member}
        created_at: '2019-01-26T19:01:12Z'
        updated_at: '2019-01-26T19:14:43Z'
    simple-user:
      value:
        login: octocat
        id: 1
        node_id: MDQ6VXNlcjE=
        avatar_url: https://github.com/images/error/octocat_happy.gif
        gravatar_id: ''
        url: https://api.github.com/users/octocat
        html_url: https://github.com/octocat
        followers_url: https://api.github.com/users/octocat/followers
        following_url: https://api.github.com/users/octocat/following{/other_user}
        gists_url: https://api.github.com/users/octocat/gists{/gist_id}
        starred_url: https://api.github.com/users/octocat/starred{/owner}{/repo}
        subscriptions_url: https://api.github.com/users/octocat/subscriptions
        organizations_url: https://api.github.com/users/octocat/orgs
        repos_url: https://api.github.com/users/octocat/repos
        events_url: https://api.github.com/users/octocat/events{/privacy}
        received_events_url: https://api.github.com/users/octocat/received_events
        type: User
        site_admin: false
  schemas:
    basic-error:
      title: Basic Error
      description: Basic Error
      type: object
      properties:
        message:
          type: string
        documentation_url:
          type: string
        url:
          type: string
        status:
          type: string
    enterprise-team:
      title: Enterprise Team
      description: Group of enterprise owners and/or members
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        description:
          type: string
        slug:
          type: string
        url:
          type: string
          format: uri
        sync_to_organizations:
          type: string
          description: 'Retired: this field will not be returned with GHEC enterprise teams.'
          example: disabled | all
        organization_selection_type:
          type: string
          example: disabled | selected | all
        group_id:
          type:
          - string
          - 'null'
          example: 62ab9291-fae2-468e-974b-7e45096d5021
        group_name:
          type:
          - string
          - 'null'
          description: 'Retired: this field will not be returned with GHEC enterprise teams.'
          example: Justice League
        html_url:
          type: string
          format: uri
          example: https://github.com/enterprises/dc/teams/justice-league
        members_url:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        notification_setting:
          type: string
          description: Whether team members will receive notifications when the team is mentioned.
          example: notifications_enabled
          enum:
          - notifications_enabled
          - notifications_disabled
      required:
      - id
      - url
      - members_url
      - name
      - html_url
      - slug
      - created_at
      - updated_at
      - group_id
    simple-user:
      title: Simple User
      description: A GitHub user.
      type: object
      properties:
        name:
          type:
          - string
          - 'null'
        email:
          type:
          - string
          - 'null'
        login:
          type: string
          example: octocat
        id:
          type: integer
          format: int64
          example: 1
        node_id:
          type: string
          example: MDQ6VXNlcjE=
        avatar_url:
          type: string
          format: uri
          example: https://github.com/images/error/octocat_happy.gif
        gravatar_id:
          type:
          - string
          - 'null'
          example: 41d064eb2195891e12d0413f63227ea7
        url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat
        html_url:
          type: string
          format: uri
          example: https://github.com/octocat
        followers_url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat/followers
        following_url:
          type: string
          example: https://api.github.com/users/octocat/following{/other_user}
        gists_url:
          type: string
          example: https://api.github.com/users/octocat/gists{/gist_id}
        starred_url:
          type: string
          example: https://api.github.com/users/octocat/starred{/owner}{/repo}
        subscriptions_url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat/subscriptions
        organizations_url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat/orgs
        repos_url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat/repos
        events_url:
          type: string
          example: https://api.github.com/users/octocat/events{/privacy}
        received_events_url:
          type: string
          format: uri
          example: https://api.github.com/users/octocat/received_events
        type:
          type: string
          example: User
        site_admin:
          type: boolean
        starred_at:
          type: string
          example: '"2020-07-09T00:17:55Z"'
        user_view_type:
          type: string
          example: public
      required:
      - avatar_url
      - events_url
      - followers_url
      - following_url
      - gists_url
      - gravatar_id
      - html_url
      - id
      - node_id
      - login
      - organizations_url
      - received_events_url
      - repos_url
      - site_admin
      - starred_url
      - subscriptions_url
      - type
      - url
externalDocs:
  description: GitHub Enterprise Cloud REST API
  url: https://docs.github.com/enterprise-cloud@latest/rest/
x-refined-from:
- github-enterprise-ghec-openapi.json
- github-enterprise-openapi.yml