GitHub Keys API

The Keys API from GitHub — 18 operation(s) for keys.

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-keys-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.1.4
  title: GitHub Application About Keys 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: Keys
paths:
  /setup/api/settings/authorized-keys:
    get:
      summary: GitHub Get All Authorized Ssh Keys
      description: The GET endpoint at /setup/api/settings/authorized-keys in the GitHub Authorization API retrieves a complete list of all authorized SSH keys that have been configured for the system. This endpoint is typically used during setup or administrative operations to audit and review which SSH public keys have been granted access to the GitHub instance, allowing administrators to manage and verify authorized access points for secure shell connections.
      operationId: getAllAuthorizedSshKeys
      tags:
      - Keys
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys
      servers:
      - url: '{protocol}://{hostname}'
        variables:
          hostname:
            default: HOSTNAME
            description: Self-hosted Enterprise Server hostname
          protocol:
            default: http
            description: Self-hosted Enterprise Server protocol
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ssh-key'
              examples:
                default:
                  $ref: '#/components/examples/ssh-key-items'
        '401':
          description: Unauthorized
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: false
        category: enterprise-admin
        subcategory: management-console
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      summary: GitHub Add an Authorized Ssh Key
      description: '**Note:** The request body for this operation must be submitted as `application/x-www-form-urlencoded` data. You can submit a parameter value as a string, or you can use a tool such as `curl` to submit a parameter value as the contents of a text file. For more information, see the [`curl` documentation](https://curl.se/docs/manpage.html#--data-urlencode).'
      operationId: addAnAuthorizedSshKey
      tags:
      - Keys
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/enterprise-admin/management-console#add-an-authorized-ssh-key
      servers:
      - url: '{protocol}://{hostname}'
        variables:
          hostname:
            default: HOSTNAME
            description: Self-hosted Enterprise Server hostname
          protocol:
            default: http
            description: Self-hosted Enterprise Server protocol
      responses:
        '201':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ssh-key'
              examples:
                default:
                  $ref: '#/components/examples/ssh-key-items'
        '401':
          description: Unauthorized
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                authorized_key:
                  type: string
                  description: The public SSH key.
              required:
              - authorized_key
            examples:
              default:
                value:
                  authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCssTL/Vtu/ODLTj0VtZoRAbvf7uiv5997GyDq0MoAZUjb5jmA5wYe2/wF6sFuhiZTnZoF1ZtCHunPp0hM/GHrn6VySBhNncx14YO8FPt1CIhEeRMSEjUK9cY3xAbS365oXY8vnUHJsS9+1tr/2bx/+4NJfcUt/Ezf1OR/0LStQXw==
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: false
        category: enterprise-admin
        subcategory: management-console
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      summary: GitHub Remove an Authorized Ssh Key
      description: '**Note:** The request body for this operation must be submitted as `application/x-www-form-urlencoded` data. You can submit a parameter value as a string, or you can use a tool such as `curl` to submit a parameter value as the contents of a text file. For more information, see the [`curl` documentation](https://curl.se/docs/manpage.html#--data-urlencode).'
      operationId: removeAnAuthorizedSshKey
      tags:
      - Keys
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key
      servers:
      - url: '{protocol}://{hostname}'
        variables:
          hostname:
            default: HOSTNAME
            description: Self-hosted Enterprise Server hostname
          protocol:
            default: http
            description: Self-hosted Enterprise Server protocol
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ssh-key'
              examples:
                default:
                  $ref: '#/components/examples/ssh-key-items'
        '401':
          description: Unauthorized
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                authorized_key:
                  type: string
                  description: The public SSH key.
              required:
              - authorized_key
            examples:
              default:
                value:
                  authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCssTL/Vtu/ODLTj0VtZoRAbvf7uiv5997GyDq0MoAZUjb5jmA5wYe2/wF6sFuhiZTnZoF1ZtCHunPp0hM/GHrn6VySBhNncx14YO8FPt1CIhEeRMSEjUK9cY3xAbS365oXY8vnUHJsS9+1tr/2bx/+4NJfcUt/Ezf1OR/0LStQXw==
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: false
        category: enterprise-admin
        subcategory: management-console
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /orgs/{org}/actions/secrets/public-key:
    get:
      summary: GitHub Get an Organization Public Key
      description: 'Gets your public key, which you need to encrypt secrets. You need to

        encrypt a secret before you can create or update secrets.


        The authenticated user must have collaborator access to a repository to create, update, or read secrets.


        OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.'
      tags:
      - Keys
      operationId: getAnOrganizationPublicKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/actions/secrets#get-an-organization-public-key
      parameters:
      - $ref: '#/components/parameters/org'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/actions-public-key'
              examples:
                default:
                  $ref: '#/components/examples/actions-public-key'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: actions
        subcategory: secrets
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /orgs/{org}/dependabot/secrets/public-key:
    get:
      summary: GitHub Get an Organization Public Key
      description: 'Gets your public key, which you need to encrypt secrets. You need to

        encrypt a secret before you can create or update secrets.


        OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.'
      tags:
      - Keys
      operationId: getAnOrganizationPublicKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/dependabot/secrets#get-an-organization-public-key
      parameters:
      - $ref: '#/components/parameters/org'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dependabot-public-key'
              examples:
                default:
                  $ref: '#/components/examples/dependabot-public-key'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: dependabot
        subcategory: secrets
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/actions/caches:
    delete:
      summary: GitHub Delete Github Actions Caches for Repository (using Cache Key)
      description: 'Deletes one or more GitHub Actions caches for a repository, using a complete cache key. By default, all caches that match the provided key are deleted, but you can optionally provide a Git ref to restrict deletions to caches that match both the provided key and the Git ref.


        OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.'
      tags:
      - Keys
      operationId: deleteGithubActionsCachesForRepositoryUsingCacheKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $ref: '#/components/parameters/actions-cache-key-required'
      - $ref: '#/components/parameters/actions-cache-git-ref-full'
      - 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:
                $ref: '#/components/schemas/actions-cache-list'
              examples:
                default:
                  $ref: '#/components/examples/actions-cache-list'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: actions
        subcategory: cache
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/actions/secrets/public-key:
    get:
      summary: GitHub Get Repository Public Key
      description: 'Gets your public key, which you need to encrypt secrets. You need to

        encrypt a secret before you can create or update secrets.


        Anyone with read access to the repository can use this endpoint.


        If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.'
      tags:
      - Keys
      operationId: getRepositoryPublicKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/actions/secrets#get-a-repository-public-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - 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:
                $ref: '#/components/schemas/actions-public-key'
              examples:
                default:
                  $ref: '#/components/examples/actions-public-key'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: actions
        subcategory: secrets
      x-api-evangelist-certified: '2025-07-16'
      x-api-naftiko-published: '2025-07-25'
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/dependabot/secrets/public-key:
    get:
      summary: GitHub Get Repository Public Key
      description: 'Gets your public key, which you need to encrypt secrets. You need to

        encrypt a secret before you can create or update secrets. Anyone with read access

        to the repository can use this endpoint.


        OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint if the repository is private.'
      tags:
      - Keys
      operationId: getRepositoryDependabotSecretsPublicKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/dependabot/secrets#get-a-repository-public-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - 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:
                $ref: '#/components/schemas/dependabot-public-key'
              examples:
                default:
                  $ref: '#/components/examples/dependabot-public-key'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: dependabot
        subcategory: secrets
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key:
    get:
      summary: GitHub Get an Environment Public Key
      description: 'Get the public key for an environment, which you need to encrypt environment

        secrets. You need to encrypt a secret before you can create or update secrets.


        Anyone with read access to the repository can use this endpoint.


        If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.'
      tags:
      - Keys
      operationId: getAnEnvironmentPublicKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/actions/secrets#get-an-environment-public-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $ref: '#/components/parameters/environment-name'
      - 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:
                $ref: '#/components/schemas/actions-public-key'
              examples:
                default:
                  $ref: '#/components/examples/actions-public-key'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: actions
        subcategory: secrets
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/keys:
    get:
      summary: GitHub List Deploy Keys
      description: The List Deploy Keys operation retrieves all deploy keys configured for a specific GitHub repository. Deploy keys are SSH keys that grant read-only or read-write access to a single repository, commonly used for deployment automation and CI/CD pipelines. This GET endpoint requires the repository owner and name as path parameters and returns an array of deploy key objects, each containing details such as the key ID, title, public key content, verification status, creation date, and whether the key has read-only or write access. Authentication is required, and the authenticated user must have admin access to the repository to successfully retrieve the list of deploy keys.
      tags:
      - Keys
      operationId: listDeployKeys
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/deploy-keys/deploy-keys#list-deploy-keys
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $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/deploy-key'
              examples:
                default:
                  $ref: '#/components/examples/deploy-key-items'
          headers:
            Link:
              $ref: '#/components/headers/link'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: deploy-keys
        subcategory: deploy-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      summary: GitHub Create Deploy Key
      description: You can create a read-only deploy key.
      tags:
      - Keys
      operationId: createDeployKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/deploy-keys/deploy-keys#create-a-deploy-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - 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:
                title:
                  type: string
                  description: name for the key.
                key:
                  type: string
                  description: The contents of the key.
                read_only:
                  type: boolean
                  description: 'If `true`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.


                    Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "[Repository permission levels for an organization](https://docs.github.com/enterprise-server@3.9/articles/repository-permission-levels-for-an-organization/)" and "[Permission levels for a user account repository](https://docs.github.com/enterprise-server@3.9/articles/permission-levels-for-a-user-account-repository/)."'
              required:
              - key
            examples:
              default:
                value:
                  title: octocat@octomac
                  key: ssh-rsa AAA...
                  read_only: true
      responses:
        '201':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deploy-key'
              examples:
                default:
                  $ref: '#/components/examples/deploy-key'
          headers:
            Location:
              example: https://api.github.com/repos/octocat/Hello-World/keys/1
              schema:
                type: string
        '422':
          $ref: '#/components/responses/validation_failed'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: deploy-keys
        subcategory: deploy-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /repos/{owner}/{repo}/keys/{key_id}:
    get:
      summary: GitHub Get Deploy Key
      description: The Get Deploy Key operation retrieves detailed information about a specific deploy key configured for a GitHub repository. By making a GET request to /repos/{owner}/{repo}/keys/{key_id}, authenticated users with appropriate permissions can access the deploy key's metadata including its unique identifier, title, the public SSH key string, creation timestamp, verification status, and whether it has read-only or read-write access to the repository. This endpoint is useful for auditing deploy keys, verifying their configuration, or retrieving key details before performing updates or deletions. The caller must have admin access to the repository to successfully retrieve deploy key information, and the key_id parameter must correspond to an existing deploy key within the specified repository.
      tags:
      - Keys
      operationId: getDeployKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/deploy-keys/deploy-keys#get-a-deploy-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $ref: '#/components/parameters/key-id'
      - 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:
                $ref: '#/components/schemas/deploy-key'
              examples:
                default:
                  $ref: '#/components/examples/deploy-key'
        '404':
          $ref: '#/components/responses/not_found'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: deploy-keys
        subcategory: deploy-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      summary: GitHub Delete Deploy Key
      description: Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
      tags:
      - Keys
      operationId: deleteDeployKey
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/deploy-keys/deploy-keys#delete-a-deploy-key
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - $ref: '#/components/parameters/key-id'
      - 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:
        '204':
          description: Response
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: deploy-keys
        subcategory: deploy-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /user/gpg_keys:
    get:
      summary: GitHub List Gpg Keys for the Authenticated User
      description: 'Lists the current user''s GPG keys.


        OAuth app tokens and personal access tokens (classic) need the `read:gpg_key` scope to use this endpoint.'
      tags:
      - Keys
      operationId: listGpgKeysForTheAuthenticatedUser
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user
      parameters:
      - $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/gpg-key'
              examples:
                default:
                  $ref: '#/components/examples/gpg-key-items'
          headers:
            Link:
              $ref: '#/components/headers/link'
        '304':
          $ref: '#/components/responses/not_modified'
        '401':
          $ref: '#/components/responses/requires_authentication'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/not_found'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: false
        category: users
        subcategory: gpg-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      summary: GitHub Create Gpg Key for the Authenticated User
      description: 'Adds a GPG key to the authenticated user''s GitHub account.


        OAuth app tokens and personal access tokens (classic) need the `write:gpg_key` scope to use this endpoint.'
      operationId: createGpgKeyForTheAuthenticatedUser
      tags:
      - Keys
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user
      parameters:
      - 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:
              properties:
                name:
                  description: A descriptive name for the new key.
                  type: string
                armored_public_key:
                  description: A GPG key in ASCII-armored format.
                  type: string
              type: object
              required:
              - armored_public_key
            examples:
              default:
                value:
                  name: Octocat's GPG Key
                  armored_public_key: '--BEGIN PGP PUBLIC KEY BLOCK--

                    Version: GnuPG v1


                    mQINBFnZ2ZIBEADQ2Z7Z7

                    --END PGP PUBLIC KEY BLOCK--'
      responses:
        '201':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/gpg-key'
              examples:
                default:
                  $ref: '#/components/examples/gpg-key'
        '304':
          $ref: '#/components/responses/not_modified'
        '401':
          $ref: '#/components/responses/requires_authentication'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/not_found'
        '422':
          $ref: '#/components/responses/validation_failed'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: false
        category: users
        subcategory: gpg-keys
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /user/gpg_keys/{gpg_key_id}:
    get:
      summary: GitHub Get Gpg Key for the Authenticated User
      description: 'View extended details for a single GPG key.


        OAuth app tokens and personal access tokens (classic) need the `read:gpg_key` scope to use this endpoint.'
      tags:
      - Keys
      operationId: getGpgKeyForTheAuthenticatedUser
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user
      parameters:
      - $ref: '#/components/parameters/gpg-key-id'
      - 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
    

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