The GPG resource allows you to manage GPG keys.
Returns a paginated list of the user's GPG public keys.
The key
and subkeys
fields can also be requested from the endpoint.
See Partial Responses for more details.
account
string
RequiredA list of the GPG keys associated with the account.
A paginated list of GPG keys.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/gpg-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": [
{
"added_on": "2024-09-24T12:09:33.154081+00:00",
"created_on": "2018-03-20T13:09:04.207005+00:00",
"expires_on": null,
"fingerprint": "h4m26ppxrol7blr7spbc7lhyymokdbnkxd06kzrt",
"key_id": "ymokdbnkxd06kzrt",
"last_used": "2024-09-25T15:18:05.196003+00:00",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}/gpg-keys/H4M26PPXROL7BLR7SPBC7LHYYMOKDBNKXD06KZRT"
}
},
"name": "Alice's OpenPGP key",
"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/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
}
},
"type": "user",
"username": "markadams-atl",
"nickname": "markadams-atl",
"uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
},
"parent_fingerprint": null,
"type": "gpg_key"
}
]
}
Adds a new GPG public key to the specified user account and returns the resulting key.
Example:
1 2 3
$ curl -X POST -H "Content-Type: application/json" -d '{"key": "<insert GPG Key>"}' https://api.bitbucket.org/2.0/users/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}/gpg-keys
account:write
string
RequiredThe new GPG key object.
allOf [object, GPG 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
.
Represents a GPG public key for a user.
The newly created GPG key.
allOf [object, GPG 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
.
Represents a GPG 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
26
27
28
29
30
31
32
curl --request POST \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/gpg-keys' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"type": "<string>",
"owner": {
"type": "<string>"
},
"key": "<string>",
"key_id": "<string>",
"fingerprint": "<string>",
"parent_fingerprint": "<string>",
"comment": "<string>",
"name": "<string>",
"expires_on": "<string>",
"created_on": "<string>",
"added_on": "<string>",
"last_used": "<string>",
"subkeys": [
{
"type": "<string>"
}
],
"links": {
"self": {
"href": "<string>",
"name": "<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
{
"added_on": "2024-09-24T12:09:33.154081+00:00",
"created_on": "2018-03-20T13:09:04.207005+00:00",
"expires_on": null,
"fingerprint": "h4m26ppxrol7blr7spbc7lhyymokdbnkxd06kzrt",
"key_id": "ymokdbnkxd06kzrt",
"last_used": "2024-09-25T15:18:05.196003+00:00",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}/gpg-keys/H4M26PPXROL7BLR7SPBC7LHYYMOKDBNKXD06KZRT"
}
},
"name": "Alice's OpenPGP key",
"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/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
}
},
"type": "user",
"username": "markadams-atl",
"nickname": "markadams-atl",
"uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
},
"parent_fingerprint": null,
"type": "gpg_key"
}
Returns a specific GPG public key belonging to a user.
The key
and subkeys
fields can also be requested from the endpoint.
See Partial Responses for more details.
account
string
Requiredstring
RequiredThe specific GPG key matching the user and fingerprint.
allOf [object, GPG 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
.
Represents a GPG public key for a user.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/gpg-keys/{fingerprint}' \
--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
{
"added_on": "2024-09-24T12:09:33.154081+00:00",
"created_on": "2018-03-20T13:09:04.207005+00:00",
"expires_on": null,
"fingerprint": "h4m26ppxrol7blr7spbc7lhyymokdbnkxd06kzrt",
"key_id": "ymokdbnkxd06kzrt",
"last_used": "2024-09-25T15:18:05.196003+00:00",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}/gpg-keys/H4M26PPXROL7BLR7SPBC7LHYYMOKDBNKXD06KZRT"
}
},
"name": "Alice's OpenPGP key",
"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/{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
}
},
"type": "user",
"username": "markadams-atl",
"nickname": "markadams-atl",
"uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}"
},
"parent_fingerprint": null,
"type": "gpg_key"
}
Deletes a specific GPG public key from a user's account.
account:write
string
Requiredstring
RequiredThe key has been deleted
1
2
3
curl --request DELETE \
--url 'https://api.bitbucket.org/2.0/users/{selected_user}/gpg-keys/{fingerprint}' \
--header 'Authorization: Bearer <access_token>'
Rate this page: