Teams are deploying code faster than ever, thanks to continuous delivery practices and tools like Bitbucket Pipelines. Bitbucket Deployments gives teams visibility into their deployment environments and helps teams to track how far changes have progressed in their deployment pipeline.
Returns all deploy-keys belonging to a repository.
repository
repository:admin
string
Requiredstring
RequiredDeploy keys matching the repository
A paginated list of deploy keys.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-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
{
"pagelen": 10,
"values": [
{
"id": 123,
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
"label": "mykey",
"type": "deploy_key",
"created_on": "2018-08-15T23:50:59.993890+00:00",
"repository": {
"full_name": "mleu/test",
"name": "test",
"type": "repository",
"uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
},
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/123"
}
},
"last_used": null,
"comment": "mleu@C02W454JHTD8"
}
],
"page": 1,
"size": 1
}
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:
1 2 3 4 5 6 7 8
$ 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" }'
repository
repository:admin
string
Requiredstring
RequiredThe deploy key that was created
allOf [object, Deploy 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 deploy key for a repository.
1
2
3
4
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-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
{
"id": 123,
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
"label": "mydeploykey",
"type": "deploy_key",
"created_on": "2018-08-15T23:50:59.993890+00:00",
"repository": {
"full_name": "mleu/test",
"name": "test",
"type": "repository",
"uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
},
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/123"
}
},
"last_used": null,
"comment": "mleu@C02W454JHTD8"
}
Returns the deploy key belonging to a specific key.
repository
repository:admin
string
Requiredstring
Requiredstring
RequiredDeploy key matching the key ID
allOf [object, Deploy 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 deploy key for a repository.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-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
{
"comment": "mleu@C02W454JHTD8",
"last_used": null,
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-key/1234"
}
},
"repository": {
"full_name": "mleu/test",
"name": "test",
"type": "repository",
"uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
},
"label": "mykey",
"created_on": "2018-08-15T23:50:59.993890+00:00",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
"id": 1234,
"type": "deploy_key"
}
Create a new deploy key in a repository.
The same key needs to be passed in but the comment and label can change.
Example:
1 2 3 4 5 6 7 8
$ curl -X PUT \ -H "Authorization <auth header>" \ -H "Content-type: application/json" \ https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/1234 -d \ '{ "label": "newlabel", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 newcomment", }'
repository
repository:admin
string
Requiredstring
Requiredstring
RequiredThe newly updated deploy key.
allOf [object, Deploy 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 deploy key for a repository.
1
2
3
4
curl --request PUT \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-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
{
"comment": "newcomment",
"last_used": null,
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/1234"
}
},
"repository": {
"full_name": "mleu/test",
"name": "test",
"type": "repository",
"uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
},
"label": "newlabel",
"created_on": "2018-08-15T23:50:59.993890+00:00",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
"id": 1234,
"type": "deploy_key"
}
This deletes a deploy key from a repository.
repository
repository:admin
string
Requiredstring
Requiredstring
RequiredThe key has been deleted
1
2
3
curl --request DELETE \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}' \
--header 'Authorization: Bearer <access_token>'
Find deployments
pipeline
read:pipeline:bitbucket
string
Requiredstring
RequiredThe matching deployments.
A paged list of deployments
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments' \
--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
{
"page": 102,
"values": [
{
"type": "<string>",
"uuid": "<string>",
"state": {
"type": "<string>"
},
"environment": {
"type": "<string>"
},
"release": {
"type": "<string>"
}
}
],
"size": 142,
"pagelen": 159,
"next": "<string>",
"previous": "<string>"
}
Retrieve a deployment
pipeline
read:pipeline:bitbucket
string
Requiredstring
Requiredstring
RequiredThe deployment.
allOf [object, Deployment]
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
.
A Bitbucket Deployment.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments/{deployment_uuid}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"type": "<string>",
"uuid": "<string>",
"state": {
"type": "<string>"
},
"environment": {
"type": "<string>"
},
"release": {
"type": "<string>"
}
}
Find environments
pipeline
read:pipeline:bitbucket
string
Requiredstring
RequiredThe matching environments.
A paged list of environments
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"page": 102,
"values": [
{
"type": "<string>",
"uuid": "<string>",
"name": "<string>"
}
],
"size": 142,
"pagelen": 159,
"next": "<string>",
"previous": "<string>"
}
Create an environment.
pipeline
admin:pipeline:bitbucket
string
Requiredstring
RequiredThe environment to create.
allOf [object, Deployment Environment]
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
.
A Bitbucket Deployment Environment.
The environment was created.
string
allOf [object, Deployment Environment]
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
.
A Bitbucket Deployment Environment.
1
2
3
4
5
6
7
8
9
10
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"type": "<string>",
"uuid": "<string>",
"name": "<string>"
}'
1
2
3
4
5
{
"type": "<string>",
"uuid": "<string>",
"name": "<string>"
}
Retrieve an environment
pipeline
read:pipeline:bitbucket
string
Requiredstring
Requiredstring
RequiredThe environment.
allOf [object, Deployment Environment]
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
.
A Bitbucket Deployment Environment.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments/{environment_uuid}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
{
"type": "<string>",
"uuid": "<string>",
"name": "<string>"
}
Delete an environment
pipeline
admin:pipeline:bitbucket
string
Requiredstring
Requiredstring
RequiredThe environment was deleted.
1
2
3
curl --request DELETE \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments/{environment_uuid}' \
--header 'Authorization: Bearer <access_token>'
Update an environment
pipeline
admin:pipeline:bitbucket
string
Requiredstring
Requiredstring
RequiredThe environment update request was accepted.
1
2
3
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments/{environment_uuid}/changes' \
--header 'Authorization: Bearer <access_token>'
Returns all deploy keys belonging to a project.
project
project:admin
string
Requiredstring
RequiredDeploy keys matching the project
A paginated list of project deploy keys.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/deploy-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
{
"pagelen": 10,
"values": [
{
"comment": "thakseth@C02W454JHTD8",
"last_used": null,
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/1234"
}
},
"label": "test",
"project": {
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT"
}
},
"type": "project",
"name": "cooperative standard",
"key": "TEST_PROJECT",
"uuid": "{3b3e510b-7f2b-414d-a2b7-76c4e405c1c0}"
},
"created_on": "2021-07-28T21:20:19.491721+00:00",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX5yfMOEw6HG9jKTYTisbmDTJ4MCUTSVGr5e4OWvY3UuI2A6F8SdzQqa2f5BABA/4g5Sk5awJrYHlNu3EzV1V2I44tR3A4fnZAG71ZKyDPi1wvdO7UYmFgxV/Vd18H9QZFFjICGDM7W0PT2mI0kON/jN3qNWi+GiB/xgaeQKSqynysdysDp8lnnI/8Sh3ikURP9UP83ShRCpAXszOUNaa+UUlcYQYBDLIGowsg51c4PCkC3DNhAMxppkNRKoSOWwyl+oRVXHSDylkiJSBHW3HH4Q6WHieD54kGrjbhWBKdnnxKX7QAAZBDseY+t01N36m6/ljvXSUEcBWtHxBYye0r",
"type": "project_deploy_key",
"id": 1234
}
],
"page": 1,
"size": 1
}
Create a new deploy key in a project.
Example:
1 2 3 4 5 6 7 8
$ curl -X POST \ -H "Authorization <auth header>" \ -H "Content-type: application/json" \ https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/ -d \ '{ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8", "label": "mydeploykey" }'
project
project:admin
string
Requiredstring
RequiredThe project deploy key that was created
allOf [object, Project Deploy 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 deploy key for a project.
1
2
3
4
curl --request POST \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/deploy-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
{
"comment": "mleu@C02W454JHTD8",
"last_used": null,
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/5/"
}
},
"label": "myprojectkey",
"project": {
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT"
}
},
"type": "project",
"name": "cooperative standard",
"key": "TEST_PROJECT",
"uuid": "{3b3e510b-7f2b-414d-a2b7-76c4e405c1c0}"
},
"created_on": "2021-08-10T05:28:00.570859+00:00",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
"type": "project_deploy_key",
"id": 5
}
Returns the deploy key belonging to a specific key ID.
project
project:admin
string
Requiredstring
Requiredstring
RequiredProject deploy key matching the key ID
allOf [object, Project Deploy 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 deploy key for a project.
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/deploy-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
{
"pagelen": 10,
"values": [
{
"comment": "thakseth@C02W454JHTD8",
"last_used": null,
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/1234"
}
},
"label": "test",
"project": {
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT"
}
},
"type": "project",
"name": "cooperative standard",
"key": "TEST_PROJECT",
"uuid": "{3b3e510b-7f2b-414d-a2b7-76c4e405c1c0}"
},
"created_on": "2021-07-28T21:20:19.491721+00:00",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX5yfMOEw6HG9jKTYTisbmDTJ4MCUTSVGr5e4OWvY3UuI2A6F8SdzQqa2f5BABA/4g5Sk5awJrYHlNu3EzV1V2I44tR3A4fnZAG71ZKyDPi1wvdO7UYmFgxV/Vd18H9QZFFjICGDM7W0PT2mI0kON/jN3qNWi+GiB/xgaeQKSqynysdysDp8lnnI/8Sh3ikURP9UP83ShRCpAXszOUNaa+UUlcYQYBDLIGowsg51c4PCkC3DNhAMxppkNRKoSOWwyl+oRVXHSDylkiJSBHW3HH4Q6WHieD54kGrjbhWBKdnnxKX7QAAZBDseY+t01N36m6/ljvXSUEcBWtHxBYye0r",
"type": "project_deploy_key",
"id": 1234
}
]
}
This deletes a deploy key from a project.
project
project:admin
string
Requiredstring
Requiredstring
RequiredThe project deploy key has been deleted
1
2
3
curl --request DELETE \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/deploy-keys/{key_id}' \
--header 'Authorization: Bearer <access_token>'
Rate this page: