GitHub Roles API

The Roles API from GitHub — 2 operation(s) for roles.

Documentation

📖
Documentation
https://docs.github.com/en/rest/apps
📖
Documentation
https://docs.github.com/en/rest/codes-of-conduct/codes-of-conduct
📖
Documentation
https://docs.github.com/en/rest/emojis
📖
Documentation
https://docs.github.com/en/rest/gitignore
📖
Documentation
https://docs.github.com/en/rest/apps/installations
📖
Documentation
https://docs.github.com/en/rest/enterprise-admin
📖
Documentation
https://docs.github.com/en/rest/activity/events
📖
Documentation
https://docs.github.com/en/rest/orgs
📖
Documentation
https://docs.github.com/en/rest/rate-limit
📖
Documentation
https://docs.github.com/en/enterprise-cloud@latest/rest/scim
📖
Documentation
https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api
📖
Documentation
https://docs.github.com/en/rest/teams
📖
Documentation
https://docs.github.com/en/rest/meta/meta
📖
Documentation
https://docs.github.com/en/rest/actions
📖
Documentation
https://docs.github.com/en/rest/branches
📖
Documentation
https://docs.github.com/en/rest/code-scanning
📖
Documentation
https://docs.github.com/en/rest/collaborators
📖
Documentation
https://docs.github.com/en/rest/dependabot
📖
Documentation
https://docs.github.com/en/rest/webhooks
📖
Documentation
https://docs.github.com/en/rest/pulls
📖
Documentation
https://docs.github.com/en/rest/git/tags
📖
Documentation
https://docs.github.com/en/rest/repos/autolinks
📖
Documentation
https://docs.github.com/en/rest/collaborators/invitations

Specifications

Other Resources

OpenAPI Specification

github-roles-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 1.1.4
  title: GitHub Org Roles API
  description: Use the REST API to control and manage all your GitHub organizations.
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  termsOfService: https://docs.github.com/articles/github-terms-of-service
  contact:
    name: Support
    url: https://support.github.com/contact?tags=dotcom-rest-api
  x-github-plan: ghes
  x-github-release: 3.9
servers:
- url: '{protocol}://{hostname}/api/v3'
  variables:
    hostname:
      description: Self-hosted Enterprise Server hostname
      default: HOSTNAME
    protocol:
      description: Self-hosted Enterprise Server protocol
      default: http
tags:
- name: Roles
paths:
  /organizations/{organization_id}/custom_roles:
    get:
      summary: GitHub Deprecated - List Custom Repository Roles in an Organization
      description: '**Note**: This operation is deprecated and will be removed in the future.

        Use the "[List custom repository roles](https://docs.github.com/enterprise-server@3.9/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization)" endpoint instead.


        List the custom repository roles available in this organization. For more information on custom repository roles, see "[About custom repository roles](https://docs.github.com/enterprise-server@3.9/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-repository-roles)."


        The authenticated user must be administrator of the organization or of a repository of the organization to use this endpoint.


        OAuth app tokens and personal access tokens (classic) need the `admin:org` or `repo` scope to use this endpoint.'
      tags:
      - Roles
      operationId: deprecatedListCustomRepositoryRolesInAnOrganization
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/orgs/custom-roles#deprecatedlist-custom-repository-roles-in-an-organization
      parameters:
      - name: organization_id
        description: The unique identifier of the organization.
        in: path
        required: true
        schema:
          type: string
        example: '12345678'
      responses:
        '200':
          description: Response - list of custom role names
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_count:
                    description: The number of custom roles in this organization
                    example: 3
                    type: integer
                  custom_roles:
                    type: array
                    items:
                      $ref: '#/components/schemas/organization-custom-repository-role'
              examples:
                default:
                  $ref: '#/components/examples/organization-custom-repository-role-example'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: true
        removalDate: '2025-02-15'
        deprecationDate: '2023-02-15'
        category: orgs
        subcategory: custom-roles
      deprecated: true
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /orgs/{org}/custom-repository-roles:
    get:
      summary: GitHub List Custom Repository Roles in an Organization
      description: 'List the custom repository roles available in this organization. For more information on custom repository roles, see "[About custom repository roles](https://docs.github.com/enterprise-server@3.9/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-repository-roles)."


        The authenticated user must be an administrator of the organization or of a repository of the organization to use this endpoint.


        OAuth app tokens and personal access tokens (classic) need the `admin:org` or `repo` scope to use this endpoint.'
      tags:
      - Roles
      operationId: listCustomRepositoryRolesInAnOrganization
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization
      parameters:
      - $ref: '#/components/parameters/org'
      responses:
        '200':
          description: Response - list of custom role names
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_count:
                    description: The number of custom roles in this organization
                    example: 3
                    type: integer
                  custom_roles:
                    type: array
                    items:
                      $ref: '#/components/schemas/organization-custom-repository-role'
              examples:
                default:
                  $ref: '#/components/examples/organization-custom-repository-role-list-example'
      x-github:
        githubCloudOnly: true
        enabledForGitHubApps: true
        category: orgs
        subcategory: custom-roles
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    simple-user:
      title: Simple User
      description: A GitHub user.
      type: object
      properties:
        name:
          type:
          - string
          - 'null'
          example: octocat
        email:
          type:
          - string
          - 'null'
          example: octocat@github.com
        login:
          type: string
          example: octocat
        id:
          type: integer
          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
          example: true
        starred_at:
          type: string
          example: '"2020-07-09T00:17:55Z"'
      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
    organization-custom-repository-role:
      title: Organization Custom Repository Role
      description: Custom repository roles created by organization owners
      type: object
      properties:
        id:
          description: The unique identifier of the custom role.
          type: integer
          example: 42
        name:
          description: The name of the custom role.
          type: string
          example: octocat
        description:
          description: A short description about who this role is for or what permissions it grants.
          type:
          - string
          - 'null'
          example: This is an example repository
        base_role:
          type: string
          description: The system role from which this role inherits permissions.
          enum:
          - read
          - triage
          - write
          - maintain
          example: read
        permissions:
          description: A list of additional permissions included in this role.
          type: array
          items:
            type: string
        organization:
          $ref: '#/components/schemas/simple-user'
        created_at:
          type: string
          format: date-time
          example: '2026-04-17T12:00:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-04-17T12:00:00Z'
      required:
      - id
      - name
      - base_role
      - permissions
      - organization
      - created_at
      - updated_at
  examples:
    organization-custom-repository-role-example:
      value:
        id: 8030
        name: Security Engineer
        description: Able to contribute code and maintain the security pipeline
        base_role: maintain
        permissions:
        - delete_alerts_code_scanning
        organization:
          login: github
          id: 1
          node_id: MDEyOk9yZ2FuaXphdGlvbjE=
          url: https://api.github.com/orgs/github
          repos_url: https://api.github.com/orgs/github/repos
          events_url: https://api.github.com/orgs/github/events
          hooks_url: https://api.github.com/orgs/github/hooks
          issues_url: https://api.github.com/orgs/github/issues
          members_url: https://api.github.com/orgs/github/members{/member}
          public_members_url: https://api.github.com/orgs/github/public_members{/member}
          avatar_url: https://github.com/images/error/octocat_happy.gif
          description: A great organization
        created_at: '2022-07-04T22:19:11Z'
        updated_at: '2022-07-04T22:20:11Z'
    organization-custom-repository-role-list-example:
      value:
        total_count: 2
        custom_roles:
        - id: 8030
          name: Security Engineer
          description: Able to contribute code and maintain the security pipeline
          base_role: maintain
          permissions:
          - delete_alerts_code_scanning
          organization:
            login: github
            id: 9919
            node_id: MDEyOk9yZ2FuaXphdGlvbjk5MTk=
            avatar_url: https://avatars.githubusercontent.com/u/9919?v=4
            gravatar_id: ''
            url: https://api.github.com/users/github
            html_url: https://github.com/github
            followers_url: https://api.github.com/users/github/followers
            following_url: https://api.github.com/users/github/following{/other_user}
            gists_url: https://api.github.com/users/github/gists{/gist_id}
            starred_url: https://api.github.com/users/github/starred{/owner}{/repo}
            subscriptions_url: https://api.github.com/users/github/subscriptions
            organizations_url: https://api.github.com/users/github/orgs
            repos_url: https://api.github.com/users/github/repos
            events_url: https://api.github.com/users/github/events{/privacy}
            received_events_url: https://api.github.com/users/github/received_events
            type: Organization
            site_admin: false
          created_at: '2022-07-04T22:19:11Z'
          updated_at: '2022-07-04T22:20:11Z'
        - id: 8031
          name: Community manager
          description: Able to handle all the community interactions without being able to contribute code
          base_role: read
          permissions:
          - mark_as_duplicate
          - manage_settings_pages
          - manage_settings_wiki
          - set_social_preview
          - edit_repo_metadata
          - toggle_discussion_comment_minimize
          organization:
            login: github
            id: 9919
            node_id: MDEyOk9yZ2FuaXphdGlvbjk5MTk=
            avatar_url: https://avatars.githubusercontent.com/u/9919?v=4
            gravatar_id: ''
            url: https://api.github.com/users/github
            html_url: https://github.com/github
            followers_url: https://api.github.com/users/github/followers
            following_url: https://api.github.com/users/github/following{/other_user}
            gists_url: https://api.github.com/users/github/gists{/gist_id}
            starred_url: https://api.github.com/users/github/starred{/owner}{/repo}
            subscriptions_url: https://api.github.com/users/github/subscriptions
            organizations_url: https://api.github.com/users/github/orgs
            repos_url: https://api.github.com/users/github/repos
            events_url: https://api.github.com/users/github/events{/privacy}
            received_events_url: https://api.github.com/users/github/received_events
            type: Organization
            site_admin: false
          created_at: '2022-07-05T12:01:11Z'
          updated_at: '2022-07-05T12:20:11Z'
  parameters:
    org:
      name: org
      description: The organization name. The name is not case sensitive.
      in: path
      required: true
      schema:
        type: string
  securitySchemes:
    bearerHttpAuthentication:
      description: Bearer Token
      type: http
      scheme: Bearer
externalDocs:
  description: GitHub Enterprise Developer Docs
  url: https://docs.github.com/enterprise-server@3.9/rest/