GitHub Files API

The Files API from GitHub — 2 operation(s) for files.

Documentation

📖
Documentation
https://docs.github.com/en/rest/apps
📖
Documentation
https://raw.githubusercontent.com/api-evangelist/github/refs/heads/main/ https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api
📖
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-files-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.1.4
  title: GitHub Application About Files API
  description: 'Use the REST API to retrieve information about GitHub Apps and GitHub App

    installations.'
  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: Files
paths:
  /repos/{owner}/{repo}/pulls/{pull_number}/files:
    get:
      summary: GitHub List Pull Requests Files
      description: 'Lists the files in a specified pull request.


        **Note:** Responses include a maximum of 3000 files. The paginated response

        returns 30 files per page by default.


        This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."


        - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.

        - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.

        - **`application/vnd.github.html+json`**: Returns HTML rendered from the body''s markdown. Response will include `body_html`.

        - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.

        - **`application/vnd.github.diff`**: For more information, see "[git-diff](https://git-scm.com/docs/git-diff)" in the Git documentation. If a diff is corrupt, contact us through the [GitHub Support portal](https://support.github.com/). Include the repository name and pull request ID in your message.'
      tags:
      - Files
      operationId: listPullRequestsFiles
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/pulls/pulls#list-pull-requests-files
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $ref: '#/components/parameters/pull-number'
      - $ref: '#/components/parameters/per-page'
      - $ref: '#/components/parameters/page'
      - in: header
        name: Authorization
        schema:
          type: string
        example: example_value
      - in: header
        name: X-GitHub-Api-Version
        schema:
          type: string
          default: '2022-11-28'
        example: example_value
      - in: header
        name: Accept
        schema:
          type: string
          default: application/vnd.github+json
        example: example_value
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/diff-entry'
              examples:
                default:
                  $ref: '#/components/examples/diff-entry-items'
          headers:
            Link:
              $ref: '#/components/headers/link'
        '422':
          $ref: '#/components/responses/validation_failed'
        '500':
          $ref: '#/components/responses/internal_error'
        '503':
          $ref: '#/components/responses/service_unavailable'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: pulls
        subcategory: pulls
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/contents/{path}:
    put:
      summary: GitHub Create or Update File Contents
      description: 'Creates a new file or replaces an existing file in a repository.


        **Note:** If you use this endpoint and the "[Delete a file](https://docs.github.com/enterprise-server@3.9/rest/repos/contents/#delete-a-file)" endpoint in parallel, the concurrent requests will conflict and you will receive errors. You must use these endpoints serially instead.


        OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint. The `workflow` scope is also required in order to modify files in the `.github/workflows` directory.'
      tags:
      - Files
      operationId: createOrUpdateFileContents
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/repos/contents#create-or-update-file-contents
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - name: path
        description: path parameter
        in: path
        required: true
        schema:
          type: string
        x-multi-segment: true
        example: src/index.js
      - in: header
        name: Authorization
        schema:
          type: string
        example: example_value
      - in: header
        name: X-GitHub-Api-Version
        schema:
          type: string
          default: '2022-11-28'
        example: example_value
      - in: header
        name: Accept
        schema:
          type: string
          default: application/vnd.github+json
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                  description: The commit message.
                content:
                  type: string
                  description: The new file content, using Base64 encoding.
                sha:
                  type: string
                  description: '**Required if you are updating a file**. The blob SHA of the file being replaced.'
                branch:
                  type: string
                  description: 'The branch name. Default: the repositorys default branch.'
                committer:
                  type: object
                  description: 'The person that committed the file. Default: the authenticated user.'
                  properties:
                    name:
                      type: string
                      description: The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted.
                    email:
                      type: string
                      description: The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted.
                    date:
                      type: string
                      example: '"2013-01-05T13:13:22+05:00"'
                  required:
                  - name
                  - email
                author:
                  type: object
                  description: 'The author of the file. Default: The `committer` or the authenticated user if you omit `committer`.'
                  properties:
                    name:
                      type: string
                      description: The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted.
                    email:
                      type: string
                      description: The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted.
                    date:
                      type: string
                      example: '"2013-01-15T17:13:22+05:00"'
                  required:
                  - name
                  - email
              required:
              - message
              - content
            examples:
              example-for-creating-a-file:
                summary: Example for creating a file
                value:
                  message: my commit message
                  committer:
                    name: Monalisa Octocat
                    email: octocat@github.com
                  content: bXkgbmV3IGZpbGUgY29udGVudHM=
              example-for-updating-a-file:
                summary: Example for updating a file
                value:
                  message: a new commit message
                  committer:
                    name: Monalisa Octocat
                    email: octocat@github.com
                  content: bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz
                  sha: 95b966ae1c166bd92f8ae7d1c313e738c731dfc3
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file-commit'
              examples:
                example-for-updating-a-file:
                  $ref: '#/components/examples/file-commit-example-for-updating-a-file'
        '201':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file-commit'
              examples:
                example-for-creating-a-file:
                  $ref: '#/components/examples/file-commit-example-for-creating-a-file'
        '404':
          $ref: '#/components/responses/not_found'
        '409':
          $ref: '#/components/responses/conflict'
        '422':
          $ref: '#/components/responses/validation_failed'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: repos
        subcategory: contents
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      summary: GitHub Delete File
      description: 'Deletes a file in a repository.


        You can provide an additional `committer` parameter, which is an object containing information about the committer. Or, you can provide an `author` parameter, which is an object containing information about the author.


        The `author` section is optional and is filled in with the `committer` information if omitted. If the `committer` information is omitted, the authenticated user''s information is used.


        You must provide values for both `name` and `email`, whether you choose to use `author` or `committer`. Otherwise, you''ll receive a `422` status code.


        **Note:** If you use this endpoint and the "[Create or update file contents](https://docs.github.com/enterprise-server@3.9/rest/repos/contents/#create-or-update-file-contents)" endpoint in parallel, the concurrent requests will conflict and you will receive errors. You must use these endpoints serially instead.'
      tags:
      - Files
      operationId: deleteFile
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/repos/contents#delete-a-file
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - name: path
        description: path parameter
        in: path
        required: true
        schema:
          type: string
        x-multi-segment: true
        example: src/index.js
      - in: header
        name: Authorization
        schema:
          type: string
        example: example_value
      - in: header
        name: X-GitHub-Api-Version
        schema:
          type: string
          default: '2022-11-28'
        example: example_value
      - in: header
        name: Accept
        schema:
          type: string
          default: application/vnd.github+json
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                  description: The commit message.
                sha:
                  type: string
                  description: The blob SHA of the file being deleted.
                branch:
                  type: string
                  description: 'The branch name. Default: the repositorys default branch'
                committer:
                  type: object
                  description: object containing information about the committer.
                  properties:
                    name:
                      type: string
                      description: The name of the author (or committer) of the commit
                    email:
                      type: string
                      description: The email of the author (or committer) of the commit
                author:
                  type: object
                  description: object containing information about the author.
                  properties:
                    name:
                      type: string
                      description: The name of the author (or committer) of the commit
                    email:
                      type: string
                      description: The email of the author (or committer) of the commit
              required:
              - message
              - sha
            examples:
              default:
                value:
                  message: my commit message
                  committer:
                    name: Monalisa Octocat
                    email: octocat@github.com
                  sha: 329688480d39049927147c162b9d2deaf885005f
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file-commit'
              examples:
                default:
                  $ref: '#/components/examples/file-commit'
        '404':
          $ref: '#/components/responses/not_found'
        '409':
          $ref: '#/components/responses/conflict'
        '422':
          $ref: '#/components/responses/validation_failed'
        '503':
          $ref: '#/components/responses/service_unavailable'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: repos
        subcategory: contents
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  examples:
    file-commit-example-for-updating-a-file:
      value:
        content:
          name: hello.txt
          path: notes/hello.txt
          sha: a56507ed892d05a37c6d6128c260937ea4d287bd
          size: 9
          url: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
          html_url: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
          git_url: https://api.github.com/repos/octocat/Hello-World/git/blobs/a56507ed892d05a37c6d6128c260937ea4d287bd
          download_url: https://raw.githubusercontent.com/octocat/HelloWorld/master/notes/hello.txt
          type: file
          _links:
            self: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
            git: https://api.github.com/repos/octocat/Hello-World/git/blobs/a56507ed892d05a37c6d6128c260937ea4d287bd
            html: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
        commit:
          sha: 18a43cd8e1e3a79c786e3d808a73d23b6d212b16
          node_id: MDY6Q29tbWl0MThhNDNjZDhlMWUzYTc5Yzc4NmUzZDgwOGE3M2QyM2I2ZDIxMmIxNg==
          url: https://api.github.com/repos/octocat/Hello-World/git/commits/18a43cd8e1e3a79c786e3d808a73d23b6d212b16
          html_url: https://github.com/octocat/Hello-World/git/commit/18a43cd8e1e3a79c786e3d808a73d23b6d212b16
          author:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          committer:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          message: my commit message
          tree:
            url: https://api.github.com/repos/octocat/Hello-World/git/trees/9a21f8e2018f42ffcf369b24d2cd20bc25c9e66f
            sha: 9a21f8e2018f42ffcf369b24d2cd20bc25c9e66f
          parents:
          - url: https://api.github.com/repos/octocat/Hello-World/git/commits/da5a433788da5c255edad7979b328b67d79f53f6
            html_url: https://github.com/octocat/Hello-World/git/commit/da5a433788da5c255edad7979b328b67d79f53f6
            sha: da5a433788da5c255edad7979b328b67d79f53f6
          verification:
            verified: false
            reason: unsigned
            signature: ''
            payload: ''
    diff-entry-items:
      value:
      - sha: bbcd538c8e72b8c175046e27cc8f907076331401
        filename: file1.txt
        status: added
        additions: 103
        deletions: 21
        changes: 124
        blob_url: https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
        raw_url: https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
        contents_url: https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e
        patch: '@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test'
    file-commit-example-for-creating-a-file:
      value:
        content:
          name: hello.txt
          path: notes/hello.txt
          sha: 95b966ae1c166bd92f8ae7d1c313e738c731dfc3
          size: 9
          url: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
          html_url: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
          git_url: https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3
          download_url: https://raw.githubusercontent.com/octocat/HelloWorld/master/notes/hello.txt
          type: file
          _links:
            self: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
            git: https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3
            html: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
        commit:
          sha: 7638417db6d59f3c431d3e1f261cc637155684cd
          node_id: MDY6Q29tbWl0NzYzODQxN2RiNmQ1OWYzYzQzMWQzZTFmMjYxY2M2MzcxNTU2ODRjZA==
          url: https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd
          html_url: https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd
          author:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          committer:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          message: my commit message
          tree:
            url: https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb
            sha: 691272480426f78a0138979dd3ce63b77f706feb
          parents:
          - url: https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5
            html_url: https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5
            sha: 1acc419d4d6a9ce985db7be48c6349a0475975b5
          verification:
            verified: false
            reason: unsigned
            signature: ''
            payload: ''
    file-commit:
      value:
        content:
          name: hello.txt
          path: notes/hello.txt
          sha: 95b966ae1c166bd92f8ae7d1c313e738c731dfc3
          size: 9
          url: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
          html_url: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
          git_url: https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3
          download_url: https://raw.githubusercontent.com/octocat/HelloWorld/master/notes/hello.txt
          type: file
          _links:
            self: https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt
            git: https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3
            html: https://github.com/octocat/Hello-World/blob/master/notes/hello.txt
        commit:
          sha: 7638417db6d59f3c431d3e1f261cc637155684cd
          node_id: MDY6Q29tbWl0NzYzODQxN2RiNmQ1OWYzYzQzMWQzZTFmMjYxY2M2MzcxNTU2ODRjZA==
          url: https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd
          html_url: https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd
          author:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          committer:
            date: '2014-11-07T22:01:45Z'
            name: Monalisa Octocat
            email: octocat@github.com
          message: my commit message
          tree:
            url: https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb
            sha: 691272480426f78a0138979dd3ce63b77f706feb
          parents:
          - url: https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5
            html_url: https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5
            sha: 1acc419d4d6a9ce985db7be48c6349a0475975b5
          verification:
            verified: false
            reason: unsigned
            signature: ''
            payload: ''
  responses:
    not_found:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
    internal_error:
      description: Internal Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
    service_unavailable:
      description: Service unavailable
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
              documentation_url:
                type: string
    conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
    validation_failed:
      description: Validation failed, or the endpoint has been spammed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/validation-error'
  headers:
    link:
      example: <https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"
      schema:
        type: string
  parameters:
    owner:
      name: owner
      description: The account owner of the repository. The name is not case sensitive.
      in: path
      required: true
      schema:
        type: string
    pull-number:
      name: pull_number
      description: The number that identifies the pull request.
      in: path
      required: true
      schema:
        type: integer
    repo:
      name: repo
      description: The name of the repository without the `.git` extension. The name is not case sensitive.
      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-server@3.9/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
      in: query
      schema:
        type: integer
        default: 30
    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-server@3.9/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
      in: query
      schema:
        type: integer
        default: 1
  schemas:
    diff-entry:
      title: Diff Entry
      description: Diff Entry
      type: object
      properties:
        sha:
          type: string
          example: bbcd538c8e72b8c175046e27cc8f907076331401
        filename:
          type: string
          example: file1.txt
        status:
          type: string
          enum:
          - added
          - removed
          - modified
          - renamed
          - copied
          - changed
          - unchanged
          example: added
        additions:
          type: integer
          example: 103
        deletions:
          type: integer
          example: 21
        changes:
          type: integer
          example: 124
        blob_url:
          type: string
          format: uri
          example: https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
        raw_url:
          type: string
          format: uri
          example: https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
        contents_url:
          type: string
          format: uri
          example: https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e
        patch:
          type: string
          example: '@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test'
        previous_filename:
          type: string
          example: file.txt
      required:
      - additions
      - blob_url
      - changes
      - contents_url
      - deletions
      - filename
      - raw_url
      - sha
      - status
    file-commit:
      title: File Commit
      description: File Commit
      type: object
      required:
      - content
      - commit
      properties:
        content:
          type: object
          properties:
            name:
              type: string
            path:
              type: string
            sha:
              type: string
            size:
              type: integer
            url:
              type: string
            html_url:
              type: string
            git_url:
              type: string
            download_url:
              type: string
            type:
              type: string
            _links:
              type: object
              properties:
                self:
                  type: string
                git:
                  type: string
                html:
                  type: string
        commit:
          type: object
          properties:
            sha:
              type: string
            node_id:
              type: string
            url:
              type: string
            html_url:
              type: string
            author:
              type: object
              properties:
                date:
                  type: string
                name:
                  type: string
                email:
                  type: string
            committer:
              type: object
              properties:
                date:
                  type: string
                name:
                  type: string
                email:
                  type: string
            message:
              type: string
            tree:
              type: object
              properties:
                url:
                  type: string
                sha:
                  type: string
            parents:
              type: array
              items:
                type: object
                properties:
                  url:
                    type: string
                  html_url:
                    type: string
                  sha:
                    type: string
            verification:
              type: object
              properties:
                verified:
                  type: boolean
                reason:
                  type: string
                signature:
                  type: string
                payload:
                  type: string
    basic-error:
      title: Basic Error
      description: Basic Error
      type: object
      properties:
        message:
          type: string
          example: Example body text
        documentation_url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        status:
          type: string
          example: open
    validation-error:
      title: Validation Error
      description: Validation Error
      type: object
      required:
      - message
      - documentation_url
      properties:
        message:
          type: string
          example: Example body text
        documentation_url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        errors:
          type: array
          items:
            type: object
            required:
            - code
            properties:
              resource:
                type: string
              field:
                type: string
              message:
                type: string
              code:
                type: string
              index:
                type: integer
              value:
                oneOf:
                - type: string
                - type: integer
                - type: array
                  items:
                    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/
x-webhooks:
  branch-protection-rule-created:
    post:
      summary: 'This event occurs when there is activity relating to branch protection rules. For more information, see "[About protected branches](https://docs.github.com/enterprise-server@3.9/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." For information about the APIs to manage branch protection rules, see [the GraphQL documentation](https://docs.github.com/enterprise-server@3.9/graphql/reference/objects#branchprotectionrule) or "[Branch protection](https://docs.github.com/enterprise-server@3.9/rest/branches/branch-protection)" in the REST API documentation.


        To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.'
      description: A branch protection rule was created.
      operationId: branch-protection-rule/created
      externalDocs:
        url: https://docs.github.com/enterprise-server@3.9/webhooks/webhook-events-and-payloads#branch_protection_rule
      parameters:
      - name: User-Agent
        in: header
        example: GitHub-Hookshot/123abc
        schema:
          type: string
      - name: X-Github-Hook-Id
        in: header
        example: 12312312
        schema:
          type: string
      - name: X-Github-Event
        in: header
        example: issues
        schema:
          type: string
      - name: X-Github-Hook-Installation-Target-Id
        in: header
        example: 123123
        schema:
          type: string
      - name: X-Github-Hook-Installation-Target-Type
        in: header
        example: repository
        schema:
          type: string
      - name: X-GitHub-Delivery
        in: header
        example: 0b989ba4-242f-11e5-81e1-c7b6966d2516
        schema:
          type: string
      - name: X-Hub-Signature-256
        in: header
        example: sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e
        schema:
          type: string
      - name: X-GitHub-Enterprise-Version
        in: header
        example: 3.1.9
        schema:
          type: string
      - name: X-GitHub-Enterprise-Host
        in: header
        example: ghes.github.com
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/webhook-branch-protection-rule-created'
      respons

# --- truncated at 32 KB (631 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/github/refs/heads/main/openapi/github-files-api-openapi.yml