Rate this page:
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.
GET /2.0/repositories/{workspace}/{repo_slug}/deploy-keys
Returns all deploy-keys belonging to a repository.
Example:
1 2$ curl -H "Authorization <auth header>" \ https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys Output: { "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 }
repository
repository:admin
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
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'
Deploy keys matching the repository
Content type | Value |
---|---|
application/json |
POST /2.0/repositories/{workspace}/{repo_slug}/deploy-keys
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$ curl -XPOST \ -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" }' Output: { "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" }
repository
repository:admin
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
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'
The deploy key that was created
Content type | Value |
---|---|
application/json | allOf [object, Deploy Key] |
GET /2.0/repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
Returns the deploy key belonging to a specific key.
Example:
1 2$ curl -H "Authorization <auth header>" \ https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-key/1234 Output: { "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" }
repository
repository:admin
string
The key ID matching the deploy key.
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
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'
Deploy key matching the key ID
Content type | Value |
---|---|
application/json | allOf [object, Deploy Key] |
PUT /2.0/repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
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$ curl -XPUT \ -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", }' Output: { "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" }
repository
repository:admin
string
The key ID matching the deploy key.
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
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'
The newly updated deploy key.
Content type | Value |
---|---|
application/json | allOf [object, Deploy Key] |
DELETE /2.0/repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
This deletes a deploy key from a repository.
Example:
1 2$ curl -XDELETE \ -H "Authorization <auth header>" \ https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/1234
repository
repository:admin
string
The key ID matching the deploy key.
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
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>'
The key has been deleted
GET /2.0/repositories/{workspace}/{repo_slug}/deployments/
Find deployments
NONE
string
This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}
.
string
The repository.
1 2 3
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments/' \
--header 'Accept: application/json'
The matching deployments.
Content type | Value |
---|---|
application/json |
GET /2.0/repositories/{workspace}/{repo_slug}/deployments/{deployment_uuid}
Retrieve a deployment
NONE
string
This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}
.
string
The repository.
string
The deployment UUID.
1 2 3
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments/{deployment_uuid}' \
--header 'Accept: application/json'
The deployment.
Content type | Value |
---|---|
application/json | allOf [object, Deployment] |
GET /2.0/repositories/{workspace}/{repo_slug}/environments/
Find environments
NONE