Pipelines 43 endpoints

POST /repositories/{workspace}/{repo_slug}/pipelines

Endpoint to create and initiate a pipeline.
There are a couple of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated.

Trigger a Pipeline for a branch

One way to trigger pipelines is by specifying the branch for which you want to trigger a pipeline.
The specified branch will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified branch.

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
 https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
  -d '
  {
    "target": {
      "ref_type": "branch",
      "type": "pipeline_ref_target",
      "ref_name": "master"
    }
  }'

Trigger a Pipeline for a commit on a branch or tag

You can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark).
The specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference.

The following reference types are supported:

  • branch
  • named_branch
  • bookmark
  • tag

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
  https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
  -d '
  {
    "target": {
      "commit": {
        "type": "commit",
        "hash": "ce5b7431602f7cbba007062eeb55225c6e18e956"
      },
      "ref_type": "branch",
      "type": "pipeline_ref_target",
      "ref_name": "master"
    }
  }'

Trigger a specific pipeline definition for a commit

You can trigger a specific pipeline that is defined in your bitbucket-pipelines.yml file for a specific commit.
In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision.

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
 https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
 -d '
  {
     "target": {
      "commit": {
         "hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923",
         "type":"commit"
       },
        "selector": {
           "type":"custom",
              "pattern":"Deploy to production"
          },
        "type":"pipeline_commit_target"
   }
  }'

Trigger a specific pipeline definition for a commit on a branch or tag

You can trigger a specific pipeline that is defined in your bitbucket-pipelines.yml file for a specific commit in the context of a specified reference.
In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference.

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
 https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
 -d '
  {
     "target": {
      "commit": {
         "hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923",
         "type":"commit"
       },
       "selector": {
          "type": "custom",
          "pattern": "Deploy to production"
       },
       "type": "pipeline_ref_target",
       "ref_name": "master",
       "ref_type": "branch"
     }
  }'

Trigger a custom pipeline with variables

In addition to triggering a custom pipeline that is defined in your bitbucket-pipelines.yml file as shown in the examples above, you can specify variables that will be available for your build. In the request, provide a list of variables, specifying the following for each variable: key, value, and whether it should be secured or not (this field is optional and defaults to not secured).

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
 https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \
 -d '
  {
    "target": {
      "type": "pipeline_ref_target",
      "ref_type": "branch",
      "ref_name": "master",
      "selector": {
        "type": "custom",
        "pattern": "Deploy to production"
      }
    },
    "variables": [
      {
        "key": "var1key",
        "value": "var1value",
        "secured": true
      },
      {
        "key": "var2key",
        "value": "var2value"
      }
    ]
  }'

Trigger a pull request pipeline

You can also initiate a pipeline for a specific pull request.

Example

$ curl -X POST -is -u username:password \
  -H 'Content-Type: application/json' \
 https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \
 -d '
  {
    "target": {
      "type": "pipeline_pullrequest_target",
      "source": "pull-request-branch",
      "destination": "master",
      "destination_commit": {
        "hash": "9f848b7"
      },
      "commit": {
        "hash": "1a372fc"
      },
      "pullrequest": {
        "id": "3"
      },
      "selector": {
        "type": "pull-requests",
        "pattern": "**"
      }
    }
  }'
operationId: Pipelines_createPipeline

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The pipeline to initiate.

application/json
schema pipeline
Property Type Required
type string required
uuid string optional
state object optional
type string required
target object optional
type string required
creator object optional
type string required
uuid string optional
links object optional
avatar object optional
href string optional
name string optional
username string optional
created_on string optional
display_name string optional
trigger object optional
type string required
variables array optional
type string required
key string optional
uuid string optional
value string optional
secured boolean optional
created_on string optional
repository object optional
type string required
scm string optional
name string optional
size integer optional
uuid string optional
links object optional
html object optional
href string optional
name string optional
self object optional
href string optional
name string optional
clone array optional
href string optional
name string optional
forks object optional
href string optional
name string optional
hooks object optional
href string optional
name string optional
avatar object optional
href string optional
name string optional
commits object optional
href string optional
name string optional
watchers object optional
href string optional
name string optional
downloads object optional
href string optional
name string optional
pullrequests object optional
href string optional
name string optional
owner object optional
type string required
uuid string optional
links object optional
avatar object optional
username string optional
created_on string optional
display_name string optional
parent object optional
project object optional
type string required
key string optional
name string optional
uuid string optional
links object optional
html object optional
avatar object optional
owner object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
created_on string optional
is_private boolean optional
updated_on string optional
description string optional
has_publicly_visible_repos boolean optional
has_wiki boolean optional
language string optional
full_name string optional
created_on string optional
has_issues boolean optional
is_private boolean optional
mainbranch object optional
name string optional
type string required
links object optional
html object optional
self object optional
commits object optional
target object optional
type string required
date string optional
hash string optional
author object optional
message string optional
parents array optional
summary object optional
repository object optional
participants array optional
merge_strategies array optional
default_merge_strategy string optional
updated_on string optional
description string optional
fork_policy string optional
build_number integer optional
completed_on string optional
build_seconds_used integer optional
configuration_sources array optional
uri string required
source string required

Responses

201

The initiated pipeline.

400

The account or repository is not enabled, the yml file does not exist in the repository for the given revision, or the request body contained invalid properties.

404

The account or repository was not found.

POST /repositories/{workspace}/{repo_slug}/pipelines
DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches

Delete repository cache versions by name.

operationId: Pipelines_deleteCacheVersionByName

Parameters

Name In Required Type Description
workspace path required string

The account.

repo_slug path required string

The repository.

name query required string

The cache name.

Responses

204

The caches were deleted.

404

The workspace, repository or cache name was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches
GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches

Retrieve the repository pipelines caches.

operationId: Pipelines_getCaches

Parameters

Name In Required Type Description
workspace path required string

The account.

repo_slug path required string

The repository.

Responses

200

The list of caches for the given repository.

404

The account or repository was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches
DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}

Delete a repository cache.

operationId: Pipelines_deleteCacheById

Parameters

Name In Required Type Description
workspace path required string

The account.

repo_slug path required string

The repository.

cache_uuid path required string

The UUID of the cache to delete.

Responses

204

The cache was deleted.

404

The workspace, repository or cache_uuid with given UUID was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}/content-uri

Retrieve the URI of the content of the specified cache.

operationId: Pipelines_getCacheContentUri

Parameters

Name In Required Type Description
workspace path required string

The account.

repo_slug path required string

The repository.

cache_uuid path required string

The UUID of the cache.

Responses

200

The cache content uri.

404

The workspace, repository or cache_uuid with given UUID was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}/content-uri
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}

Retrieve a specified pipeline

operationId: Pipelines_getSpecifiedPipeline

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The pipeline UUID.

Responses

200

The pipeline.

404

No account, repository or pipeline with the UUID provided exists.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps

Find steps for the given pipeline.

operationId: Pipelines_getPipelineSteps

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

Responses

200

The steps.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}

Retrieve a given step of a pipeline.

operationId: Pipelines_getStep

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

Responses

200

The step.

404

No account, repository, pipeline or step with the UUID provided exists for the pipeline with the UUID provided.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log

Retrieve the log file for a given step of a pipeline.

This endpoint supports (and encourages!) the use of HTTP Range requests to deal with potentially very large log files.

operationId: Pipelines_getStepLog

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

Responses

200

The raw log file for this pipeline step.

304

The log has the same etag as the provided If-None-Match header.

404

A pipeline with the given UUID does not exist, a step with the given UUID does not exist in the pipeline or a log file does not exist for the given step.

416

The requested range does not exist for requests that specified the HTTP Range header.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/logs/{log_uuid}

Retrieve the log file for a build container or service container.

This endpoint supports (and encourages!) the use of HTTP Range requests to deal with potentially very large log files.

operationId: Pipelines_getStepLogs

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

log_uuid path required string

For the main build container specify the step UUID; for a service container specify the service container UUID

Responses

200

The raw log file for the build container or service container.

404

No account, repository, pipeline, step or log exist for the provided path.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/logs/{log_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports
operationId: Pipelines_getTestReportsForStep

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

Responses

200

A summary of test reports for this pipeline step.

404

No account, repository, pipeline, step or test reports exist for the provided path.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases
operationId: Pipelines_getTestCasesForStep

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

Responses

200

Test cases for this pipeline step.

404

No account, repository, pipeline, step or test reports exist for the provided path.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases/{test_case_uuid}/test_case_reasons
operationId: Pipelines_getTestCaseReasons

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

step_uuid path required string

The UUID of the step.

test_case_uuid path required string

The UUID of the test case.

Responses

200

Test case reasons (output).

404

No account, repository, pipeline, step or test case with the UUID provided exists for the pipeline with the UUID provided.

GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases/{test_case_uuid}/test_case_reasons
POST /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline

Signal the stop of a pipeline and all of its steps that not have completed yet.

operationId: Pipelines_stopPipeline

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

pipeline_uuid path required string

The UUID of the pipeline.

Responses

204

The pipeline has been signaled to stop.

400

The specified pipeline has already completed.

404

Either the account, repository or pipeline with the given UUID does not exist.

POST /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline
GET /repositories/{workspace}/{repo_slug}/pipelines_config

Retrieve the repository pipelines configuration.

operationId: Pipelines_getConfiguration

Parameters

Name In Required Type Description
workspace path required string

The account.

repo_slug path required string

The repository.

Responses

200

The repository pipelines configuration.

GET /repositories/{workspace}/{repo_slug}/pipelines_config
PUT /repositories/{workspace}/{repo_slug}/pipelines_config

Update the pipelines configuration for a repository.

operationId: Pipelines_updateConfiguration

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The updated repository pipelines configuration.

application/json
schema pipelines_config
Property Type Required
type string required
enabled boolean optional
repository object optional
type string required
scm string optional
name string optional
size integer optional
uuid string optional
links object optional
html object optional
href string optional
name string optional
self object optional
href string optional
name string optional
clone array optional
href string optional
name string optional
forks object optional
href string optional
name string optional
hooks object optional
href string optional
name string optional
avatar object optional
href string optional
name string optional
commits object optional
href string optional
name string optional
watchers object optional
href string optional
name string optional
downloads object optional
href string optional
name string optional
pullrequests object optional
href string optional
name string optional
owner object optional
type string required
uuid string optional
links object optional
avatar object optional
username string optional
created_on string optional
display_name string optional
parent object optional
project object optional
type string required
key string optional
name string optional
uuid string optional
links object optional
html object optional
avatar object optional
owner object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
created_on string optional
is_private boolean optional
updated_on string optional
description string optional
has_publicly_visible_repos boolean optional
has_wiki boolean optional
language string optional
full_name string optional
created_on string optional
has_issues boolean optional
is_private boolean optional
mainbranch object optional
name string optional
type string required
links object optional
html object optional
self object optional
commits object optional
target object optional
type string required
date string optional
hash string optional
author object optional
message string optional
parents array optional
summary object optional
repository object optional
participants array optional
merge_strategies array optional
default_merge_strategy string optional
updated_on string optional
description string optional
fork_policy string optional

Responses

200

The repository pipelines configuration was updated.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/build_number

Update the next build number that should be assigned to a pipeline. The next build number that will be configured has to be strictly higher than the current latest build number for this repository.

operationId: Pipelines_updateNextBuildNumber

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The build number to update.

application/json
schema pipeline_build_number
Property Type Required
type string required
next integer optional

Responses

200

The build number has been configured.

400

The update failed because the next number was invalid (it should be higher than the current number).

404

The account or repository was not found.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config/build_number
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules

Retrieve the configured schedules for the given repository.

operationId: Pipelines_listSchedules

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Responses

200

The list of schedules.

404

The account or repository was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules
POST /repositories/{workspace}/{repo_slug}/pipelines_config/schedules

Create a schedule for the given repository.

operationId: Pipelines_createSchedule

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The schedule to create.

application/json
schema pipeline_schedule_post_request_body
Property Type Required
type string required
target object required
ref_name string required
ref_type string required
selector object required
type string required
pattern string optional
enabled boolean optional
cron_pattern string required

Responses

201

The created schedule.

400

There were errors validating the request.

401

The maximum limit of schedules for this repository was reached.

404

The account or repository was not found.

POST /repositories/{workspace}/{repo_slug}/pipelines_config/schedules
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}

Delete a schedule.

operationId: Pipelines_deleteSchedule

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

schedule_uuid path required string

The uuid of the schedule.

Responses

204

The schedule was deleted.

404

The account, repository or schedule was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}

Retrieve a schedule by its UUID.

operationId: Pipelines_getConfigSchedule

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

schedule_uuid path required string

The uuid of the schedule.

Responses

200

The requested schedule.

404

The account, repository or schedule was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}

Update a schedule.

operationId: Pipelines_updateSchedule

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

schedule_uuid path required string

The uuid of the schedule.

Request Body

required

The schedule to update.

application/json
schema pipeline_schedule_put_request_body
Property Type Required
type string required
enabled boolean optional

Responses

200

The schedule is updated.

404

The account, repository or schedule was not found.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions

Retrieve the executions of a given schedule.

operationId: Pipelines_listScheduleExecutions

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

schedule_uuid path required string

The uuid of the schedule.

Responses

200

The list of executions of a schedule.

404

The account or repository was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair

Delete the repository SSH key pair.

operationId: Pipelines_deleteSshKeyPair

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Responses

204

The SSH key pair was deleted.

404

The account, repository or SSH key pair was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair

Retrieve the repository SSH key pair excluding the SSH private key. The private key is a write only field and will never be exposed in the logs or the REST API.

operationId: Pipelines_getKeyPair

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Responses

200

The SSH key pair.

404

The account, repository or SSH key pair was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair

Create or update the repository SSH key pair. The private key will be set as a default SSH identity in your build container.

operationId: Pipelines_updateSshKeyPair

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The created or updated SSH key pair.

application/json
schema pipeline_ssh_key_pair
Property Type Required
type string required
public_key string optional
private_key string optional

Responses

200

The SSH key pair was created or updated.

404

The account, repository or SSH key pair was not found.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts

Find repository level known hosts.

operationId: Pipelines_listKnownHosts

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Responses

200

The retrieved known hosts.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts
POST /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts

Create a repository level known host.

operationId: Pipelines_createKnownHost

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The known host to create.

application/json
schema pipeline_known_host
Property Type Required
type string required
uuid string optional
hostname string optional
public_key object optional
type string required
key string optional
key_type string optional
md5_fingerprint string optional
sha256_fingerprint string optional

Responses

201

The known host was created.

404

The account or repository does not exist.

409

A known host with the provided hostname already exists.

POST /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}

Delete a repository level known host.

operationId: Pipelines_deleteKnownHost

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

known_host_uuid path required string

The UUID of the known host to delete.

Responses

204

The known host was deleted.

404

The account, repository or known host with given UUID was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}

Retrieve a repository level known host.

operationId: Pipelines_getKnownHost

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

known_host_uuid path required string

The UUID of the known host to retrieve.

Responses

200

The known host.

404

The account, repository or known host with the specified UUID was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}

Update a repository level known host.

operationId: Pipelines_updateKnownHost

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

known_host_uuid path required string

The UUID of the known host to update.

Request Body

required

The updated known host.

application/json
schema pipeline_known_host
Property Type Required
type string required
uuid string optional
hostname string optional
public_key object optional
type string required
key string optional
key_type string optional
md5_fingerprint string optional
sha256_fingerprint string optional

Responses

200

The known host was updated.

404

The account, repository or known host with the given UUID was not found.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables

Find repository level variables.

operationId: Pipelines_listRepositoryVariables

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Responses

200

The retrieved variables.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables
POST /repositories/{workspace}/{repo_slug}/pipelines_config/variables

Create a repository level variable.

operationId: Pipelines_createVariable

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

Request Body

required

The variable to create.

application/json
schema pipeline_variable
Property Type Required
type string required
key string optional
uuid string optional
value string optional
secured boolean optional

Responses

201

The variable was created.

404

The account or repository does not exist.

409

A variable with the provided key already exists.

POST /repositories/{workspace}/{repo_slug}/pipelines_config/variables
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}

Delete a repository level variable.

operationId: Pipelines_deleteVariable

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

variable_uuid path required string

The UUID of the variable to delete.

Responses

204

The variable was deleted.

404

The account, repository or variable with given UUID was not found.

DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}
GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}

Retrieve a repository level variable.

operationId: Pipelines_getRepositoryVariable

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

variable_uuid path required string

The UUID of the variable to retrieve.

Responses

200

The variable.

404

The account, repository or variable with the specified UUID was not found.

GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}

Update a repository level variable.

operationId: Pipelines_updateVariableForRepository

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

repo_slug path required string

The repository.

variable_uuid path required string

The UUID of the variable to update.

Request Body

required

The updated variable

application/json
schema pipeline_variable
Property Type Required
type string required
key string optional
uuid string optional
value string optional
secured boolean optional

Responses

200

The variable was updated.

404

The account, repository or variable with the given UUID was not found.

PUT /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid}
GET /workspaces/{workspace}/pipelines-config/identity/oidc/.well-known/openid-configuration

This is part of OpenID Connect for Pipelines, see https://support.atlassian.com/bitbucket-cloud/docs/integrate-pipelines-with-resource-servers-using-oidc/

operationId: Pipelines_getOpenIdConfiguration

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

Responses

200

The OpenID configuration

404

The workspace was not found.

GET /workspaces/{workspace}/pipelines-config/identity/oidc/.well-known/openid-configuration
GET /workspaces/{workspace}/pipelines-config/identity/oidc/keys.json

This is part of OpenID Connect for Pipelines, see https://support.atlassian.com/bitbucket-cloud/docs/integrate-pipelines-with-resource-servers-using-oidc/

operationId: Pipelines_getOidcKeys

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

Responses

200

The keys in JSON web key format

404

The workspace was not found.

GET /workspaces/{workspace}/pipelines-config/identity/oidc/keys.json
GET /workspaces/{workspace}/pipelines-config/variables

Find workspace level variables.

operationId: Pipelines_listWorkspaceVariables

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

Responses

200

The found workspace level variables.

GET /workspaces/{workspace}/pipelines-config/variables
POST /workspaces/{workspace}/pipelines-config/variables

Create a workspace level variable.

operationId: Pipelines_createWorkspaceVariable

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

Request Body

The variable to create.

application/json
schema pipeline_variable
Property Type Required
type string required
key string optional
uuid string optional
value string optional
secured boolean optional

Responses

201

The created variable.

404

The workspace does not exist.

409

A variable with the provided key already exists.

POST /workspaces/{workspace}/pipelines-config/variables
DELETE /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}

Delete a workspace level variable.

operationId: Pipelines_deleteWorkspaceVariable

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

variable_uuid path required string

The UUID of the variable to delete.

Responses

204

The variable was deleted

404

The workspace or the variable with the provided UUID does not exist.

DELETE /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}
GET /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}

Retrieve a workspace level variable.

operationId: Pipelines_getVariableForWorkspace

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

variable_uuid path required string

The UUID of the variable to retrieve.

Responses

200

The variable.

404

The workspace or variable with the given UUID was not found.

GET /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}
PUT /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}

Update a workspace level variable.

operationId: Pipelines_updateVariableWorkspace

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.

variable_uuid path required string

The UUID of the variable.

Request Body

The updated variable.

application/json
schema pipeline_variable
Property Type Required
type string required
key string optional
uuid string optional
value string optional
secured boolean optional

Responses

200

The variable was updated.

404

The workspace or the variable was not found.

PUT /workspaces/{workspace}/pipelines-config/variables/{variable_uuid}

Projects 7 endpoints

POST /workspaces/{workspace}/projects

Creates a new project.

Note that the avatar has to be embedded as either a data-url
or a URL to an external image as shown in the examples below:

$ body=$(cat << EOF
{
    "name": "Mars Project",
    "key": "MARS",
    "description": "Software for colonizing mars.",
    "links": {
        "avatar": {
            "href": "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/..."
        }
    },
    "is_private": false
}
EOF
)
$ curl -H "Content-Type: application/json" \
       -X POST \
       -d "$body" \
       https://api.bitbucket.org/2.0/workspaces/teams-in-space/projects/ | jq .
{
  // Serialized project document
}

or even:

$ body=$(cat << EOF
{
    "name": "Mars Project",
    "key": "MARS",
    "description": "Software for colonizing mars.",
    "links": {
        "avatar": {
            "href": "http://i.imgur.com/72tRx4w.gif"
        }
    },
    "is_private": false
}
EOF
)
$ curl -H "Content-Type: application/json" \
       -X POST \
       -d "$body" \
       https://api.bitbucket.org/2.0/workspaces/teams-in-space/projects/ | jq .
{
  // Serialized project document
}
operationId: Projects_createProjectInWorkspace

Parameters

Name In Required Type Description
workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

application/json
schema project
Property Type Required
type string required
key string optional
name string optional
uuid string optional
links object optional
html object optional
href string optional
name string optional
avatar object optional
href string optional
name string optional
owner object optional
type string required
uuid string optional
links object optional
avatar object optional
href string optional
name string optional
html object optional
href string optional
name string optional
self object optional
href string optional
name string optional
members object optional
href string optional
name string optional
projects object optional
href string optional
name string optional
repositories object optional
href string optional
name string optional
username string optional
created_on string optional
display_name string optional
created_on string optional
is_private boolean optional
updated_on string optional
description string optional
has_publicly_visible_repos boolean optional

Responses

201

A new project has been created.

403

The requesting user isn’t authorized to create the project.

404

A workspace doesn’t exist at this location.

POST /workspaces/{workspace}/projects
DELETE /workspaces/{workspace}/projects/{project_key}

Deletes this project. This is an irreversible operation.

You cannot delete a project that still contains repositories.
To delete the project, delete
or transfer the repositories first.

Example:

$ curl -X DELETE https://api.bitbucket.org/2.0/workspaces/bbworkspace1/projects/PROJ
operationId: Projects_deleteWorkspaceProject

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned
to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

Successful deletion.

403

The requesting user isn’t authorized to delete the project or the project isn’t empty.

404

A project isn’t hosted at this location.

DELETE /workspaces/{workspace}/projects/{project_key}
GET /workspaces/{workspace}/projects/{project_key}

Returns the requested project.

operationId: Projects_getByWorkspace

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned
to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The project that is part of a workspace.

401

The request wasn’t authenticated.

403

The requesting user isn’t authorized to access the project.

404

A project isn’t hosted at this location.

GET /workspaces/{workspace}/projects/{project_key}
PUT /workspaces/{workspace}/projects/{project_key}

Since this endpoint can be used to both update and to create a
project, the request body depends on the intent.

Creation

See the POST documentation for the project collection for an
example of the request body.

Note: The key should not be specified in the body of request
(since it is already present in the URL). The name is required,
everything else is optional.

Update

See the POST documentation for the project collection for an
example of the request body.

Note: The key is not required in the body (since it is already in
the URL). The key may be specified in the body, if the intent is
to change the key itself. In such a scenario, the location of the
project is changed and is returned in the Location header of the
response.

operationId: Projects_updateProjectInWorkspace

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned
to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

application/json
schema project
Property Type Required
type string required
key string optional
name string optional
uuid string optional
links object optional
html object optional
href string optional
name string optional
avatar object optional
href string optional
name string optional
owner object optional
type string required
uuid string optional
links object optional
avatar object optional
href string optional
name string optional
html object optional
href string optional
name string optional
self object optional
href string optional
name string optional
members object optional
href string optional
name string optional
projects object optional
href string optional
name string optional
repositories object optional
href string optional
name string optional
username string optional
created_on string optional
display_name string optional
created_on string optional
is_private boolean optional
updated_on string optional
description string optional
has_publicly_visible_repos boolean optional

Responses

200

The existing project is has been updated.

201

A new project has been created.

403

The requesting user isn’t authorized to update or create the project.

404

A workspace doesn’t exist at the location. Note that the project’s absence from this location doesn’t raise a 404, since a PUT at a non-existent location can be used to create a new project.

PUT /workspaces/{workspace}/projects/{project_key}
GET /workspaces/{workspace}/projects/{project_key}/default-reviewers

Return a list of all default reviewers for a project. This is a list of users that will be added as default
reviewers to pull requests for any repository within the project.

operationId: Projects_listDefaultReviewers

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned
to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The list of project default reviewers

403

If the authenticated user does not have admin access to the project

404

If the workspace or project does not exist at this location

GET /workspaces/{workspace}/projects/{project_key}/default-reviewers
DELETE /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}

Removes a default reviewer from the project.

Example:

$ curl https://api.bitbucket.org/2.0/.../default-reviewers/%7Bf0e0e8e9-66c1-4b85-a784-44a9eb9ef1a6%7D

HTTP/1.1 204
operationId: Projects_removeDefaultReviewer

Parameters

Name In Required Type Description
project_key path required string

The project in question. This can either be the actual key assigned
to the project or the UUID (surrounded by curly-braces ({})).

selected_user path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

The specified user was removed from the list of project default reviewers

400

If the specified user is not a default reviewer for the project

403

If the authenticated user does not have admin access to the project

404

If the specified user, project, or workspace does not exist

DELETE /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}
GET /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}

Returns the specified default reviewer.

operationId: Projects_getReviewer

Parameters

Name In Required Type Description
project_key path required string

The project in question. This can either be the actual key assigned
to the project or the UUID (surrounded by curly-braces ({})).

selected_user path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The specified user that is a default reviewer

400

If the specified user is not a default reviewer for the project

403

If the authenticated user does not have admin access to the project

404

If the specified user, project, or workspace does not exist

GET /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}
Load more endpoints