Deployments

Add a repository deploy key

Changed on

Create a new deploy key in a repository. Note: If authenticating a deploy key with an OAuth consumer, any changes to the OAuth consumer will subsequently invalidate the deploy key.

Example:

$ curl -X POST \
-H "Authorization <auth header>" \
-H "Content-type: application/json" \
https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys -d \
'{
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8",
    "label": "mydeploykey"
}'
post/repositories/{workspace}/{repo_slug}/deploy-keys

Request

  • Base URL
    https://api.bitbucket.org/2.0
  • URL
    https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-keys
  • Auth
    • OAuth 2
      Authorization code: https://bitbucket.org/site/oauth2/authorize
      Token URL: https://bitbucket.org/site/oauth2/access_token scopes: repository, repository:admin
    • or HTTP basic
    • or API key in header Authorization

Response

The deploy key that was created

typestring required
keystring

The deploy key value.

commentstring

The comment parsed from the deploy key (if present)

labelstring

The user-defined label for the deploy key

added_onstring date-time
last_usedstring date-time

Changes

    • warning

      removed the optional property /// from the response with the status

    • warning

      removed the optional property /////////////// from the response with the status

    • warning

      removed the optional property //////////// from the response with the status

    • warning

      removed the optional property ///// from the response with the status

    • warning

      removed the optional property /////////// from the response with the status

    • warning

      added the new rebase_fast_forward enum value to the ////// response property for the response status

    • warning

      added the new rebase_merge enum value to the ////// response property for the response status

    • warning

      added the new squash_fast_forward enum value to the ////// response property for the response status

    • info

      added the optional property /////////// to the response with the status