The SSH resource allows you to manage SSH keys.
Returns a paginated list of the user's SSH public keys.
accountread:ssh-key:bitbucketstring
RequiredA list of the SSH keys associated with the account.
A paginated list of SSH keys.
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'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"page": 1,
"pagelen": 10,
"size": 1,
"values": [
{
"comment": "user@myhost",
"created_on": "2018-03-14T13:17:05.196003+00:00",
"expires_on": null,
"fingerprint": "w9tZSiFoZ8oXwS4ZSWrJopGxwvnPIewA6Mo4owAHPrI",
"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}"
}
]
}Adds a new SSH public key to the specified user account and returns the resulting key.
Example:
1$ 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
account:writeread:ssh-key:bitbucket, write:ssh-key:bitbucketstring
Requiredstring
The new SSH key object. Note that the username property has been deprecated due to privacy changes.
allOf [allOf [object, SSH Key], SSH Account Key]
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
Base type for representing SSH public keys.
Represents an SSH public key for a user.
The newly created SSH key.
allOf [allOf [object, SSH Key], SSH Account Key]
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
Base type for representing SSH public keys.
Represents an SSH public key for a user.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
curl --request POST \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"type": "<string>",
"uuid": "<string>",
"key": "<string>",
"comment": "<string>",
"label": "<string>",
"created_on": "<string>",
"last_used": "<string>",
"links": {
"self": {
"href": "<string>",
"name": "<string>"
}
},
"owner": {
"type": "<string>"
},
"expires_on": "<string>",
"fingerprint": "<string>"
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"comment": "user@myhost",
"created_on": "2018-03-14T13:17:05.196003+00:00",
"expires_on": null,
"fingerprint": "w9tZSiFoZ8oXwS4ZSWrJopGxwvnPIewA6Mo4owAHPrI",
"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}"
}Returns a specific SSH public key belonging to a user.
accountread:ssh-key:bitbucketstring
Requiredstring
RequiredThe specific SSH key matching the user and UUID
allOf [allOf [object, SSH Key], SSH Account Key]
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
Base type for representing SSH public keys.
Represents an SSH public key for a user.
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'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"comment": "user@myhost",
"created_on": "2018-03-14T13:17:05.196003+00:00",
"expires_on": null,
"fingerprint": "w9tZSiFoZ8oXwS4ZSWrJopGxwvnPIewA6Mo4owAHPrI",
"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}"
}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$ 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}
account:writeread:ssh-key:bitbucket, write:ssh-key:bitbucketstring
Requiredstring
RequiredThe updated SSH key object
allOf [allOf [object, SSH Key], SSH Account Key]
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
Base type for representing SSH public keys.
Represents an SSH public key for a user.
The newly updated SSH key.
allOf [allOf [object, SSH Key], SSH Account Key]
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
Base type for representing SSH public keys.
Represents an SSH public key for a user.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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' \
--header 'Content-Type: application/json' \
--data '{
"type": "<string>",
"uuid": "<string>",
"key": "<string>",
"comment": "<string>",
"label": "<string>",
"created_on": "<string>",
"last_used": "<string>",
"links": {
"self": {
"href": "<string>",
"name": "<string>"
}
},
"owner": {
"type": "<string>"
},
"expires_on": "<string>",
"fingerprint": "<string>"
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"comment": "",
"created_on": "2018-03-14T13:17:05.196003+00:00",
"expires_on": null,
"fingerprint": "w9tZSiFoZ8oXwS4ZSWrJopGxwvnPIewA6Mo4owAHPrI",
"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}"
}Deletes a specific SSH public key from a user's account.
account:writedelete:ssh-key:bitbucketstring
Requiredstring
RequiredThe key has been deleted
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>'Rate this page: