v2

latestOpenAPI 3.0.02026-08-013312111.4 MB
Commit statuses

Create a build status for a commit

Creates a new build status against the specified commit.

If the specified key already exists, the existing status object will be overwritten.

Example:

curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo/commit/e10dae226959c2194f2b07b077c07762d93821cf/statuses/build/           -X POST -u jdoe -H 'Content-Type: application/json'           -d '{
    "key": "MY-BUILD",
    "state": "SUCCESSFUL",
    "description": "42 tests passed",
    "url": "https://www.example.org/my-build-result"
  }'

When creating a new commit status, you can use a URI template for the URL. Templates are URLs that contain variable names that Bitbucket will evaluate at runtime whenever the URL is displayed anywhere similar to parameter substitution in Bitbucket Connect. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time. The context variables available are repository and commit.

To associate a commit status to a pull request, the refname field must be set to the source branch of the pull request.

Example:

curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo/commit/e10dae226959c2194f2b07b077c07762d93821cf/statuses/build/           -X POST -u jdoe -H 'Content-Type: application/json'           -d '{
    "key": "MY-BUILD",
    "state": "SUCCESSFUL",
    "description": "42 tests passed",
    "url": "https://www.example.org/my-build-result",
    "refname": "my-pr-branch"
  }'
post/repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build

Request body

typestring required
keystring required

An identifier for the status that's unique to its type (current "build" is the only supported type) and the vendor, e.g. BB-DEPLOY

refnamestring

The name of the ref that pointed to this commit at the time the status object was created. Note that this the ref may since have moved off of the commit. This optional field can be useful for build systems whose build triggers and configuration are branch-dependent (e.g. a Pipeline build). It is legitimate for this field to not be set, or even apply (e.g. a static linting job).

urlstring

A URL linking back to the vendor or build system, for providing more information about whatever process produced this status. Accepts context variables repository and commit that Bitbucket will evaluate at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time.

state'FAILED' | 'INPROGRESS' | 'STOPPED' | 'SUCCESSFUL' required

Provides some indication of the status of this commit

namestring

An identifier for the build itself, e.g. BB-DEPLOY-1

descriptionstring

A description of the build (e.g. "Unit tests in Bamboo")

created_onstring date-time
updated_onstring date-time

Response

The newly created build status object.

typestring required
keystring required

An identifier for the status that's unique to its type (current "build" is the only supported type) and the vendor, e.g. BB-DEPLOY

refnamestring

The name of the ref that pointed to this commit at the time the status object was created. Note that this the ref may since have moved off of the commit. This optional field can be useful for build systems whose build triggers and configuration are branch-dependent (e.g. a Pipeline build). It is legitimate for this field to not be set, or even apply (e.g. a static linting job).

urlstring

A URL linking back to the vendor or build system, for providing more information about whatever process produced this status. Accepts context variables repository and commit that Bitbucket will evaluate at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time.

state'FAILED' | 'INPROGRESS' | 'STOPPED' | 'SUCCESSFUL' required

Provides some indication of the status of this commit

namestring

An identifier for the build itself, e.g. BB-DEPLOY-1

descriptionstring

A description of the build (e.g. "Unit tests in Bamboo")

created_onstring date-time
updated_onstring date-time