| | --- |
| | title: REST API endpoints for deploy keys |
| | shortTitle: Deploy keys |
| | intro: Use the REST API to create and manage deploy keys. |
| | versions: |
| | fpt: '*' |
| | ghec: '*' |
| | ghes: '*' |
| | topics: |
| | - API |
| | allowTitleToDifferFromFilename: true |
| | redirect_from: |
| | - /rest/reference/deploy_keys |
| | autogenerated: rest |
| | --- |
| | |
| | ## About deploy keys |
| |
|
| | {% data reusables.repositories.deploy-keys %} |
| |
|
| | Deploy keys can either be set up using the following API endpoints, or by using the {% data variables.product.company_short %} web interface. To learn how to set deploy keys up in the web interface, see [AUTOTITLE](/authentication/connecting-to-github-with-ssh/managing-deploy-keys). |
| | |
| | {% ifversion deploy-keys-enterprise-org-policy %} |
| | |
| | You may be unable to create deploy keys if your organization or enterprise owner has set a policy to restrict their use. Furthermore, if this policy is enabled at the organization or enterprise level, existing deploy keys may be disabled. For more information, see [AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-deploy-keys) and [AUTOTITLE](/organizations/managing-organization-settings/restricting-deploy-keys-in-your-organization). |
| | {% endif %} |
| | |
| | There are a few cases when a deploy key will be deleted by other activity: |
| | |
| | * If the deploy key is created with a {% data variables.product.pat_generic %}, deleting the {% data variables.product.pat_generic %} will also delete the deploy key. Regenerating the {% data variables.product.pat_generic %} will not delete the deploy key. |
| | * If the deploy key is created with an {% data variables.product.prodname_oauth_app %} token, revoking the token will also delete the deploy key. |
| |
|
| | Conversely, these activities will not delete a deploy key: |
| |
|
| | * If the deploy key is created with a {% data variables.product.prodname_github_app %} user access token, revoking the token will not delete the deploy key. |
| | * If the deploy key is created with a {% data variables.product.prodname_github_app %} installation access token, uninstalling or deleting the app will not delete the deploy key. |
| | * If the deploy key is created with a {% data variables.product.pat_generic %}, regenerating the {% data variables.product.pat_generic %} will not delete the deploy key. |
| |
|
| | <!-- Content after this section is automatically generated --> |
| |
|