Skip to end of metadata
Go to start of metadata

Overview

Manage ssh keys used for deploying product builds. All the calls for this resource require authentication as the account owner. The deploy-keys fields are the following:

FieldDescription
pkThe key identifier (ID).
keyPublic key value.
labelThe user-visible label on the key.

You cannot update an existing deploy key.  Instead, you must DELETE the key and recreate a new one with a POST call.

GET a list of keys

Gets a list of the keys associated with an repository. You can specify the following parameters with this call:

Parameter
Required?
Description
accountnameYesThe team or individual account.
repo_slugYesThe repo identifier (not to be confused with the repo's name).
GET https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/deploy-keys 
 Click here to expand the response...

GET the key's content

Gets the content of the specified key_id. This call requires authentication. You can specify the following parameters with this call:

Parameter
Required?
Description
accountnameYesThe team or individual account.
repo_slugYesThe repo identifier (not to be confused with the repo's name).
pkYesThe key identifier assigned by Bitbucket. Use the GET call to obtain this value.
 GET https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/deploy-keys/{pk}
 Click here to expand...

POST a new key

Creates a key on the specified account. You must supply a valid key that is unique across the Bitbucket service. A public key contains characters need to be escaped before sending it as a POST data. So, use the proper escaping ( urlencode ), if you are testing to add a key via your terminal. This call requires authentication. You can specify the following parameters with this call:

Parameter
Required?
Description
accountnameYesThe team or individual account.
repo_slugYesThe repo identifier (not to be confused with the repo's name).
labelNoA display name for the key.
keyYesThe content of the key.
POST https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/deploy-keys --data "key=value"
 Click here to expand the response...

DELETE a key

Deletes the key specified by the key_id value. This call requires authentication. You can specify the following parameters with this call:

Parameter
Required?
Description
accountnameYesThe team or individual account.
repo_slugYesThe repo identifier (not to be confused with the repo's name).
pkYesThe key identifier assigned by Bitbucket. Use the GET call to obtain this value.
DELETE https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/deploy-keys/{pk}

Returns HTTP 204 on success.