Rate this page:
The SSH resource allows you to manage SSH keys.
GET /2.0/users/{selected_user}/ssh-keys
Returns a paginated list of the user's SSH public keys.
Example:
1 2$ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys { "page": 1, "pagelen": 10, "size": 1, "values": [ { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}" } ] }
account
string
This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}
, OR an Atlassian Account ID.
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
A list of the SSH keys associated with the account.
Content type | Value |
---|---|
application/json |
POST /2.0/users/{selected_user}/ssh-keys
Adds a new SSH public key to the specified user account and returns the resulting key.
Example:
1 2$ curl -X POST -H "Content-Type: application/json" -d '{"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}" }
account:write
string
This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}
, OR an Atlassian Account ID.
Content type | Value |
---|---|
application/json | allOf [allOf [object, SSH Key], SSH Account Key] |
1 2 3 4
curl --request POST \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
The newly created SSH key.
Content type | Value |
---|---|
application/json | allOf [allOf [object, SSH Key], SSH Account Key] |
GET /2.0/users/{selected_user}/ssh-keys/{key_id}
Returns a specific SSH public key belonging to a user.
Example:
1 2$ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3} { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}" }
account
string
The SSH key's UUID value.
string
This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}
, OR an Atlassian Account ID.
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys/{key_id}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
The specific SSH key matching the user and UUID
Content type | Value |
---|---|
application/json | allOf [allOf [object, SSH Key], SSH Account Key] |
PUT /2.0/users/{selected_user}/ssh-keys/{key_id}
Updates a specific SSH public key on a user's account
Note: Only the 'comment' field can be updated using this API. To modify the key or comment values, you must delete and add the key again.
Example:
1 2$ curl -X PUT -H "Content-Type: application/json" -d '{"label": "Work key"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} { "comment": "", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "Work key", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}" }
account:write
string
The SSH key's UUID value.
string
This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}
, OR an Atlassian Account ID.
Content type | Value |
---|---|
application/json | allOf [allOf [object, SSH Key], SSH Account Key] |
1 2 3 4
curl --request PUT \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys/{key_id}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
The newly updated SSH key.
Content type | Value |
---|---|
application/json | allOf [allOf [object, SSH Key], SSH Account Key] |
DELETE /2.0/users/{selected_user}/ssh-keys/{key_id}
Deletes a specific SSH public key from a user's account
Example:
1 2$ curl -X DELETE https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a}
account:write
string
The SSH key's UUID value.
string
This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}
, OR an Atlassian Account ID.
1 2 3
curl --request DELETE \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys/{key_id}' \
--header 'Authorization: Bearer <access_token>'
The key has been deleted
Rate this page: