Bitbucket API

Git code hosting and collaboration

developer.atlassian.com/cloud/bitbucket/rest ↗
Version
2.0
OpenAPI
3.0.0
Endpoints
318
Schemas
216
93
Quality
Updated
3 days ago
Developer tools git code-hosting developer-tools
Use this API in your AI agent

Query structured spec data via REST or MCP. Get exactly what your agent needs.

Get API Key

Server URLs

https://api.bitbucket.org/2.0

Endpoints

Addon 10 endpoints

DELETE /addon

Deletes the application for the user.

This endpoint is intended to be used by Bitbucket Connect apps
and only supports JWT authentication – that is how Bitbucket
identifies the particular installation of the app. Developers
with applications registered in the “Develop Apps” section
of Bitbucket Marketplace need not use this endpoint as
updates for those applications can be sent out via the
UI of that section.

$ curl -X DELETE https://api.bitbucket.org/2.0/addon \
  -H "Authorization: JWT <JWT Token>"
operationId: Addon_deleteUserApp

Responses

204

Request has succeeded. The application has been deleted for the user.

401

No authorization.

403

Improper authentication.

DELETE /addon
PUT /addon

Updates the application installation for the user.

This endpoint is intended to be used by Bitbucket Connect apps
and only supports JWT authentication – that is how Bitbucket
identifies the particular installation of the app. Developers
with applications registered in the “Develop Apps” section
of Bitbucket need not use this endpoint as updates for those
applications can be sent out via the UI of that section.

Passing an empty body will update the installation using the
existing descriptor URL.

$ curl -X PUT https://api.bitbucket.org/2.0/addon \
  -H "Authorization: JWT <JWT Token>" \
  --header "Content-Type: application/json" \
  --data '{}'

The new descriptor for the installation can be also provided
in the body directly.

$ curl -X PUT https://api.bitbucket.org/2.0/addon \
  -H "Authorization: JWT <JWT Token>" \
  --header "Content-Type: application/json" \
  --data '{"descriptor": $NEW_DESCRIPTOR}'

In both these modes the URL of the descriptor cannot be changed. To
change the descriptor location and upgrade an installation
the request must be made exclusively with a descriptor_url.

$ curl -X PUT https://api.bitbucket.org/2.0/addon \
  -H "Authorization: JWT <JWT Token>" \
  --header "Content-Type: application/json" \
  --data '{"descriptor_url": $NEW_URL}'

The descriptor_url must exactly match the marketplace registration
that Atlassian has for the application. Contact your Atlassian
developer advocate to update this registration. Once the registration
has been updated you may call this resource for each installation.

Note that the scopes of the application cannot be increased
in the new descriptor nor reduced to none.

operationId: Addon_updateAppInstallation

Responses

204

Request has succeeded. The installation has been updated to the new descriptor.

400

Scopes have increased or decreased to none.

401

No authorization.

403

Improper authentication.

PUT /addon
GET /addon/linkers

Gets a list of all linkers
for the authenticated application.

operationId: Addon_listLinkers

Responses

200

Successful.

401

Authentication must use app JWT

GET /addon/linkers
GET /addon/linkers/{linker_key}

Gets a linker specified by linker_key
for the authenticated application.

operationId: Addon_getLinker

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

Responses

200

Successful.

401

Authentication must use app JWT

404

The linker does not exist.

GET /addon/linkers/{linker_key}
DELETE /addon/linkers/{linker_key}/values

Delete all linker values for the
specified linker of the authenticated application.

operationId: Addon_deleteLinkerValues

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

Responses

204

Successfully deleted the linker values.

401

Authentication must use app JWT

404

The linker does not exist.

DELETE /addon/linkers/{linker_key}/values
GET /addon/linkers/{linker_key}/values

Gets a list of all linker values for the
specified linker of the authenticated application.

A linker value lets applications supply values to modify its regular expression.

The base regular expression must use a Bitbucket-specific match group (?K)
which will be translated to ([\w\-]+). A value must match this pattern.

Read more about linker values

operationId: Addon_listLinkerValues

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

Responses

200

Successful.

401

Authentication must use app JWT

404

The linker does not exist.

GET /addon/linkers/{linker_key}/values
POST /addon/linkers/{linker_key}/values

Creates a linker value for the specified
linker of authenticated application.

A linker value lets applications supply values to modify its regular expression.

The base regular expression must use a Bitbucket-specific match group (?K)
which will be translated to ([\w\-]+). A value must match this pattern.

Read more about linker values

operationId: Addon_createLinkerValue

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

Responses

201

Successfully created the linker value.

401

Authentication must use app JWT

404

The linker does not exist.

409

The linker already has the value being added.

POST /addon/linkers/{linker_key}/values
PUT /addon/linkers/{linker_key}/values

Bulk update linker values for the specified
linker of the authenticated application.

A linker value lets applications supply values to modify its regular expression.

The base regular expression must use a Bitbucket-specific match group (?K)
which will be translated to ([\w\-]+). A value must match this pattern.

Read more about linker values

operationId: Addon_updateLinkerValues

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

Responses

204

Successfully updated the linker values.

400

Invalid input.

401

Authentication must use app JWT

404

The linker does not exist.

PUT /addon/linkers/{linker_key}/values
DELETE /addon/linkers/{linker_key}/values/{value_id}

Delete a single linker value
of the authenticated application.

operationId: Addon_deleteLinkerValue

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

value_id path required integer

The numeric ID of the linker value.

Responses

204

Successfully deleted the linker value.

401

Authentication must use app JWT

404

The linker value does not exist.

DELETE /addon/linkers/{linker_key}/values/{value_id}
GET /addon/linkers/{linker_key}/values/{value_id}

Get a single linker value
of the authenticated application.

operationId: Addon_getLinkerValue

Parameters

Name In Required Type Description
linker_key path required string

The unique key of a linker module
as defined in an application descriptor.

value_id path required integer

The numeric ID of the linker value.

Responses

200

Successful.

401

Authentication must use app JWT

404

The linker value does not exist.

GET /addon/linkers/{linker_key}/values/{value_id}

Branchrestrictions 5 endpoints

GET /repositories/{workspace}/{repo_slug}/branch-restrictions

Returns a paginated list of all branch restrictions on the
repository.

operationId: BranchRestrictions_listBranchRestrictions

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

kind query optional string

Branch restrictions of this type

pattern query optional string

Branch restrictions applied to branches of this pattern

Responses

200

A paginated list of branch restrictions

401

If the request was not authenticated

403

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

404

If the repository does not exist

GET /repositories/{workspace}/{repo_slug}/branch-restrictions
POST /repositories/{workspace}/{repo_slug}/branch-restrictions

Creates a new branch restriction rule for a repository.

kind describes what will be restricted. Allowed values include:
push, force, delete, restrict_merges, require_tasks_to_be_completed,
require_approvals_to_merge, require_default_reviewer_approvals_to_merge,
require_no_changes_requested, require_passing_builds_to_merge, require_commits_behind,
reset_pullrequest_approvals_on_change, smart_reset_pullrequest_approvals,
reset_pullrequest_changes_requested_on_change, require_all_dependencies_merged,
enforce_merge_checks, and allow_auto_merge_when_builds_pass.

Different kinds of branch restrictions have different requirements:

  • push and restrict_merges require users and groups to be
    specified. Empty lists are allowed, in which case permission is
    denied for everybody.

The restriction applies to all branches that match. There are
two ways to match a branch. It is configured in branch_match_kind:

  1. glob: Matches a branch against the pattern. A '*' in
    pattern will expand to match zero or more characters, and every
    other character matches itself. For example, 'foo*' will match
    'foo' and 'foobar', but not 'barfoo'. '*' will match all
    branches.
  2. branching_model: Matches a branch against the repository’s
    branching model. The branch_type controls the type of branch
    to match. Allowed values include: production, development,
    bugfix, release, feature and hotfix.

The combination of kind and match must be unique. This means that
two glob restrictions in a repository cannot have the same kind and
pattern. Additionally, two branching_model restrictions in a
repository cannot have the same kind and branch_type.

users and groups are lists of users and groups that are except from
the restriction. They can only be configured in push and
restrict_merges restrictions. The push restriction stops a user
pushing to matching branches unless that user is in users or is a
member of a group in groups. The restrict_merges stops a user
merging pull requests to matching branches unless that user is in
users or is a member of a group in groups. Adding new users or
groups to an existing restriction should be done via PUT.

Note that branch restrictions with overlapping matchers is allowed,
but the resulting behavior may be surprising.

operationId: BranchRestrictions_createRule

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

required

The new rule

application/json
schema branchrestriction
Property Type Required
type string required
users array 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
groups array optional
type string required
name string optional
slug string optional
links object optional
html object optional
href string optional
name string optional
self 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
full_slug string optional
workspace object optional
type string required
name string optional
slug string optional
uuid string optional
links object optional
html object optional
self object optional
avatar object optional
owners object optional
members object optional
projects object optional
snippets object optional
repositories object optional
created_on string optional
is_private boolean optional
updated_on string optional

Responses

201

A paginated list of branch restrictions

401

If the request was not authenticated

403

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

404

If the repository does not exist

POST /repositories/{workspace}/{repo_slug}/branch-restrictions
DELETE /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Deletes an existing branch restriction rule.

operationId: BranchRestrictions_deleteRule

Parameters

Name In Required Type Description
id path required string

The restriction rule’s id

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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
401

If the request was not authenticated

403

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

404

If the repository or branch restriction id does not exist

DELETE /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}
GET /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Returns a specific branch restriction rule.

operationId: BranchRestrictions_getRule

Parameters

Name In Required Type Description
id path required string

The restriction rule’s id

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 branch restriction rule

401

If the request was not authenticated

403

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

404

If the repository or branch restriction id does not exist

GET /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}
PUT /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Updates an existing branch restriction rule.

Fields not present in the request body are ignored.

See POST for details.

operationId: BranchRestrictions_updateRule

Parameters

Name In Required Type Description
id path required string

The restriction rule’s id

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

required

The new version of the existing rule

application/json
schema branchrestriction
Property Type Required
type string required
users array 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
groups array optional
type string required
name string optional
slug string optional
links object optional
html object optional
href string optional
name string optional
self 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
full_slug string optional
workspace object optional
type string required
name string optional
slug string optional
uuid string optional
links object optional
html object optional
self object optional
avatar object optional
owners object optional
members object optional
projects object optional
snippets object optional
repositories object optional
created_on string optional
is_private boolean optional
updated_on string optional

Responses

200

The updated branch restriction rule

401

If the request was not authenticated

403

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

404

If the repository or branch restriction id does not exist

PUT /repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Branchingmodel 7 endpoints

GET /repositories/{workspace}/{repo_slug}/branching-model

Return the branching model as applied to the repository. This view is
read-only. The branching model settings can be changed using the
settings API.

The returned object:

  1. Always has a development property. development.branch contains
    the actual repository branch object that is considered to be the
    development branch. development.branch will not be present
    if it does not exist.
  2. Might have a production property. production will not
    be present when production is disabled.
    production.branch contains the actual branch object that is
    considered to be the production branch. production.branch will
    not be present if it does not exist.
  3. Always has a branch_types array which contains all enabled branch
    types.
operationId: BranchingModel_getBranchingModel

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 branching model object

401

If the request was not authenticated

403

If the authenticated user does not have read access to the repository

404

If the repository does not exist

GET /repositories/{workspace}/{repo_slug}/branching-model
GET /repositories/{workspace}/{repo_slug}/branching-model/settings

Return the branching model configuration for a repository. The returned
object:

  1. Always has a development property for the development branch.
  2. Always a production property for the production branch. The
    production branch can be disabled.
  3. The branch_types contains all the branch types.

This is the raw configuration for the branching model. A client
wishing to see the branching model with its actual current branches may
find the active model API more useful.

operationId: BranchingModel_getRepositoryBranchingSettings

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 branching model configuration

401

If the request was not authenticated

403

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

404

If the repository does not exist

GET /repositories/{workspace}/{repo_slug}/branching-model/settings
PUT /repositories/{workspace}/{repo_slug}/branching-model/settings

Update the branching model configuration for a repository.

The development branch can be configured to a specific branch or to
track the main branch. When set to a specific branch it must
currently exist. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
development property will leave the development branch unchanged.

It is possible for the development branch to be invalid. This
happens when it points at a specific branch that has been
deleted. This is indicated in the is_valid field for the branch. It is
not possible to update the settings for development if that
would leave the branch in an invalid state. Such a request will be
rejected.

The production branch can be a specific branch, the main
branch or disabled. When set to a specific branch it must currently
exist. The enabled property can be used to enable (true) or
disable (false) it. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
production property will leave the production branch unchanged.

It is possible for the production branch to be invalid. This
happens when it points at a specific branch that has been
deleted. This is indicated in the is_valid field for the branch. A
request that would leave production enabled and invalid will be
rejected. It is possible to update production and make it invalid if
it would also be left disabled.

The branch_types property contains the branch types to be updated.
Only the branch types passed will be updated. All updates will be
rejected if it would leave the branching model in an invalid state.
For branch types this means that:

  1. The prefixes for all enabled branch types are valid. For example,
    it is not possible to use ‘*’ inside a Git prefix.
  2. A prefix of an enabled branch type must not be a prefix of another
    enabled branch type. This is to ensure that a branch can be easily
    classified by its prefix unambiguously.

It is possible to store an invalid prefix if that branch type would be
left disabled. Only the passed properties will be updated. The
properties not passed will be left unchanged. Each branch type must
have a kind property to identify it.

There is currently a side effect when using this API endpoint. If the
repository is inheriting branching model settings from its project,
updating the branching model for this repository will disable the
project setting inheritance.

We have deprecated this side effect and will remove it on 1 August 2022.

operationId: BranchingModel_updateConfig

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 updated branching model configuration

400

If the request contains invalid branching model configuration

401

If the request was not authenticated

403

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

404

If the repository does not exist

PUT /repositories/{workspace}/{repo_slug}/branching-model/settings
GET /repositories/{workspace}/{repo_slug}/effective-branching-model
operationId: BranchingModel_getEffectiveBranchingModel

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 effective branching model object

401

If the request was not authenticated

403

If the authenticated user does not have read access to the repository

404

If the repository does not exist

GET /repositories/{workspace}/{repo_slug}/effective-branching-model
GET /workspaces/{workspace}/projects/{project_key}/branching-model

Return the branching model set at the project level. This view is
read-only. The branching model settings can be changed using the
settings
API.

The returned object:

  1. Always has a development property. development.name is
    the user-specified branch that can be inherited by an individual repository’s
    branching model.
  2. Might have a production property. production will not
    be present when production is disabled.
    production.name is the user-specified branch that can be
    inherited by an individual repository’s branching model.
  3. Always has a branch_types array which contains all enabled branch
    types.
operationId: BranchingModel_getBranchingModel

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 branching model object

401

If the request was not authenticated

403

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

404

If the project does not exist

GET /workspaces/{workspace}/projects/{project_key}/branching-model
GET /workspaces/{workspace}/projects/{project_key}/branching-model/settings

Return the branching model configuration for a project. The returned
object:

  1. Always has a development property for the development branch.
  2. Always a production property for the production branch. The
    production branch can be disabled.
  3. The branch_types contains all the branch types.

This is the raw configuration for the branching model. A client
wishing to see the branching model with its actual current branches may find the
active model API
more useful.

operationId: BranchingModel_getConfig

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 branching model configuration

401

If the request was not authenticated

403

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

404

If the project does not exist

GET /workspaces/{workspace}/projects/{project_key}/branching-model/settings
PUT /workspaces/{workspace}/projects/{project_key}/branching-model/settings

Update the branching model configuration for a project.

The development branch can be configured to a specific branch or to
track the main branch. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
development property will leave the development branch unchanged.

The production branch can be a specific branch, the main
branch or disabled. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. The enabled property can be used to enable (true)
or disable (false) it. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
production property will leave the production branch unchanged.

The branch_types property contains the branch types to be updated.
Only the branch types passed will be updated. All updates will be
rejected if it would leave the branching model in an invalid state.
For branch types this means that:

  1. The prefixes for all enabled branch types are valid. For example,
    it is not possible to use ‘*’ inside a Git prefix.
  2. A prefix of an enabled branch type must not be a prefix of another
    enabled branch type. This is to ensure that a branch can be easily
    classified by its prefix unambiguously.

It is possible to store an invalid prefix if that branch type would be
left disabled. Only the passed properties will be updated. The
properties not passed will be left unchanged. Each branch type must
have a kind property to identify it.

operationId: BranchingModel_updateProjectBranchingModelSettings

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 updated branching model configuration

400

If the request contains an invalid branching model configuration

401

If the request was not authenticated

403

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

404

If the project does not exist

PUT /workspaces/{workspace}/projects/{project_key}/branching-model/settings

Commitstatuses 4 endpoints

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses

Returns all statuses (e.g. build results) for a specific commit.

operationId: CommitStatuses_listForCommit

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

q query optional string

Query string to narrow down the response as per
filtering and sorting.

sort query optional string

Field by which the results should be sorted as per
filtering and sorting.
Defaults to created_on.

Responses

200

A paginated list of all commit statuses for this commit.

401

If the repository is private and the request was not authenticated.

404

If the repository or commit does not exist

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build

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.

operationId: CommitStatuses_createBuildStatus

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

The new commit status object.

application/json
schema commitstatus
Property Type Required
type string required
key string optional
url string optional
name string optional
uuid string optional
links object optional
self object optional
href string optional
name string optional
commit object optional
href string optional
name string optional
state string optional
refname string optional
created_on string optional
updated_on string optional
description string optional

Responses

201

The newly created build status object.

401

If the repository is private and the request was not authenticated.

404

If the repository, commit, or build status key does not exist

POST /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build/{key}

Returns the specified build status for a commit.

operationId: CommitStatuses_getBuildStatus

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

key path required string

The build status’ unique key

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 build status object with the specified key.

401

If the repository is private and the request was not authenticated.

404

If the repository, commit, or build status key does not exist

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build/{key}
PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build/{key}

Used to update the current status of a build status object on the
specific commit.

This operation can also be used to change other properties of the
build status:

  • state
  • name
  • description
  • url
  • refname

The key cannot be changed.

operationId: CommitStatuses_updateBuildStatus

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

key path required string

The build status’ unique key

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

The updated build status object

application/json
schema commitstatus
Property Type Required
type string required
key string optional
url string optional
name string optional
uuid string optional
links object optional
self object optional
href string optional
name string optional
commit object optional
href string optional
name string optional
state string optional
refname string optional
created_on string optional
updated_on string optional
description string optional

Responses

200

The updated build status object.

401

If the repository is private and the request was not authenticated.

404

If the repository or build does not exist

PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build/{key}

Commits 16 endpoints

GET /repositories/{workspace}/{repo_slug}/commit/{commit}

Returns the specified commit.

operationId: Commits_getCommitDetails

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 commit object

404

If the specified commit or repository does not exist.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}
DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/approve

Redact the authenticated user’s approval of the specified commit.

This operation is only available to users that have explicit access to
the repository. In contrast, just the fact that a repository is
publicly accessible to users does not give them the ability to approve
commits.

operationId: Commits_unapproveCommit

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

An empty response indicating the authenticated user’s approval has been withdrawn.

404

If the specified commit, or the repository does not exist.

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/approve
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/approve

Approve the specified commit as the authenticated user.

This operation is only available to users that have explicit access to
the repository. In contrast, just the fact that a repository is
publicly accessible to users does not give them the ability to approve
commits.

operationId: Commits_approveCommit

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 participant object recording that the authenticated user approved the commit.

404

If the specified commit, or the repository does not exist.

POST /repositories/{workspace}/{repo_slug}/commit/{commit}/approve
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/comments

Returns the commit’s comments.

This includes both global and inline comments.

The default sorting is oldest to newest and can be overridden with
the sort query parameter.

operationId: Commits_listComments

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

q query optional string

Query string to narrow down the response as per
filtering and sorting.

sort query optional string

Field by which the results should be sorted as per
filtering and sorting.

Responses

200

A paginated list of commit comments.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/comments
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/comments

Creates new comment on the specified commit.

To post a reply to an existing comment, include the parent.id field:

$ curl https://api.bitbucket.org/2.0/repositories/atlassian/prlinks/commit/db9ba1e031d07a02603eae0e559a7adc010257fc/comments/ \
  -X POST -u evzijst \
  -H 'Content-Type: application/json' \
  -d '{"content": {"raw": "One more thing!"},
       "parent": {"id": 5728901}}'
operationId: Commits_createComment

Parameters

Name In Required Type Description
commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

required

The specified comment.

application/json
schema commit_comment
Property Type Required
type string required
id integer optional
user 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
links object optional
code 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
inline object optional
to integer optional
from integer optional
path string required
parent object optional
content object optional
raw string optional
html string optional
markup string optional
deleted boolean optional
created_on string optional
updated_on string optional
commit object optional
type string required
date string optional
hash string optional
author object optional
type string required
raw string optional
user object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
message string optional
parents array optional
summary object optional
raw string optional
html string optional
markup 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
self object optional
clone array optional
forks object optional
hooks object optional
avatar object optional
commits object optional
watchers object optional
downloads object optional
pullrequests 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
parent object optional
project object optional
type string required
key string optional
name string optional
uuid string optional
links object optional
owner object 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
target object optional
merge_strategies array optional
default_merge_strategy string optional
updated_on string optional
description string optional
fork_policy string optional
participants array optional
type string required
role string optional
user object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
state string optional
approved boolean optional
participated_on string optional

Responses

201

The newly created comment.

400

If the comment was detected as spam, or if the parent comment is not attached to the same node as the new comment

404

If a parent ID was passed in that cannot be found

POST /repositories/{workspace}/{repo_slug}/commit/{commit}/comments
DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}

Deletes the specified commit comment.

Note that deleting comments that have visible replies that point to
them will not really delete the resource. This is to retain the integrity
of the original comment tree. Instead, the deleted element is set to
true and the content is blanked out. The comment will continue to be
returned by the collections and self endpoints.

operationId: Commits_deleteComment

Parameters

Name In Required Type Description
comment_id path required integer

The id of the comment.

commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

Indicates the comment was deleted by this action or a previous delete.

404

If the comment doesn’t exist

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}

Returns the specified commit comment.

operationId: Commits_getCommitComment

Parameters

Name In Required Type Description
comment_id path required integer

The id of the comment.

commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 commit comment.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}

Used to update the contents of a comment. Only the content of the comment can be updated.

$ curl https://api.bitbucket.org/2.0/repositories/atlassian/prlinks/commit/7f71b5/comments/5728901 \
  -X PUT -u evzijst \
  -H 'Content-Type: application/json' \
  -d '{"content": {"raw": "One more thing!"}'
operationId: Commits_updateComment

Parameters

Name In Required Type Description
comment_id path required integer

The id of the comment.

commit path required string

The commit’s SHA1.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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}.

Request Body

required

The updated comment.

application/json
schema commit_comment
Property Type Required
type string required
id integer optional
user 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
links object optional
code 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
inline object optional
to integer optional
from integer optional
path string required
parent object optional
content object optional
raw string optional
html string optional
markup string optional
deleted boolean optional
created_on string optional
updated_on string optional
commit object optional
type string required
date string optional
hash string optional
author object optional
type string required
raw string optional
user object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
message string optional
parents array optional
summary object optional
raw string optional
html string optional
markup 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
self object optional
clone array optional
forks object optional
hooks object optional
avatar object optional
commits object optional
watchers object optional
downloads object optional
pullrequests 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
parent object optional
project object optional
type string required
key string optional
name string optional
uuid string optional
links object optional
owner object 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
target object optional
merge_strategies array optional
default_merge_strategy string optional
updated_on string optional
description string optional
fork_policy string optional
participants array optional
type string required
role string optional
user object optional
type string required
uuid string optional
links object optional
username string optional
created_on string optional
display_name string optional
state string optional
approved boolean optional
participated_on string optional

Responses

201

The newly updated comment.

400

If the comment update was detected as spam

PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
GET /repositories/{workspace}/{repo_slug}/commits

These are the repository’s commits. They are paginated and returned
in reverse chronological order, similar to the output of git log.
Like these tools, the DAG can be filtered.

GET /repositories/{workspace}/{repo_slug}/commits/

Returns all commits in the repo in topological order (newest commit
first). All branches and tags are included (similar to
git log --all).

GET /repositories/{workspace}/{repo_slug}/commits/?exclude=master

Returns all commits in the repo that are not on master
(similar to git log --all ^master).

GET /repositories/{workspace}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar

Returns all commits that are on refs foo or bar, but not on fu or
fubar (similar to git log foo bar ^fu ^fubar).

An optional path parameter can be specified that will limit the
results to commits that affect that path. path can either be a file
or a directory. If a directory is specified, commits are returned that
have modified any file in the directory tree rooted by path. It is
important to note that if the path parameter is specified, the commits
returned by this endpoint may no longer be a DAG, parent commits that
do not modify the path will be omitted from the response.

GET /repositories/{workspace}/{repo_slug}/commits/?path=README.md&include=foo&include=bar&exclude=master

Returns all commits that are on refs foo or bar, but not on master
that changed the file README.md.

GET /repositories/{workspace}/{repo_slug}/commits/?path=src/&include=foo&include=bar&exclude=master

Returns all commits that are on refs foo or bar, but not on master
that changed to a file in any file in the directory src or its children.

Because the response could include a very large number of commits, it
is paginated. Follow the ‘next’ link in the response to navigate to the
next page of commits. As with other paginated resources, do not
construct your own links.

When the include and exclude parameters are more than can fit in a
query string, clients can use a x-www-form-urlencoded POST instead.

operationId: Commits_list

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

A paginated list of commits

404

If the specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/commits
POST /repositories/{workspace}/{repo_slug}/commits

Identical to GET /repositories/{workspace}/{repo_slug}/commits,
except that POST allows clients to place the include and exclude
parameters in the request body to avoid URL length issues.

Note that this resource does NOT support new commit creation.

operationId: Commits_listWithIncludeExclude

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

A paginated list of commits

404

If the specified repository does not exist.

POST /repositories/{workspace}/{repo_slug}/commits
GET /repositories/{workspace}/{repo_slug}/commits/{revision}

These are the repository’s commits. They are paginated and returned
in reverse chronological order, similar to the output of git log.
Like these tools, the DAG can be filtered.

GET /repositories/{workspace}/{repo_slug}/commits/master

Returns all commits on ref master (similar to git log master).

GET /repositories/{workspace}/{repo_slug}/commits/dev?include=foo&exclude=master

Returns all commits on ref dev or foo, except those that are reachable on
master (similar to git log dev foo ^master).

An optional path parameter can be specified that will limit the
results to commits that affect that path. path can either be a file
or a directory. If a directory is specified, commits are returned that
have modified any file in the directory tree rooted by path. It is
important to note that if the path parameter is specified, the commits
returned by this endpoint may no longer be a DAG, parent commits that
do not modify the path will be omitted from the response.

GET /repositories/{workspace}/{repo_slug}/commits/dev?path=README.md&include=foo&include=bar&exclude=master

Returns all commits that are on refs dev or foo or bar, but not on master
that changed the file README.md.

GET /repositories/{workspace}/{repo_slug}/commits/dev?path=src/&include=foo&exclude=master

Returns all commits that are on refs dev or foo, but not on master
that changed to a file in any file in the directory src or its children.

Because the response could include a very large number of commits, it
is paginated. Follow the ‘next’ link in the response to navigate to the
next page of commits. As with other paginated resources, do not
construct your own links.

When the include and exclude parameters are more than can fit in a
query string, clients can use a x-www-form-urlencoded POST instead.

operationId: Commits_listForRevision

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

revision path required string

A commit SHA1 or ref name.

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

A paginated list of commits

404

If the specified revision does not exist.

GET /repositories/{workspace}/{repo_slug}/commits/{revision}
POST /repositories/{workspace}/{repo_slug}/commits/{revision}

Identical to GET /repositories/{workspace}/{repo_slug}/commits/{revision},
except that POST allows clients to place the include and exclude
parameters in the request body to avoid URL length issues.

Note that this resource does NOT support new commit creation.

operationId: Commits_listForRevision

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

revision path required string

A commit SHA1 or ref name.

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

A paginated list of commits

404

If the specified revision does not exist.

POST /repositories/{workspace}/{repo_slug}/commits/{revision}
GET /repositories/{workspace}/{repo_slug}/diff/{spec}

Produces a raw git-style diff.

Single commit spec

If the spec argument to this API is a single commit, the diff is
produced against the first parent of the specified commit.

Two commit spec

Two commits separated by .. may be provided as the spec, e.g.,
3a8b42..9ff173. When two commits are provided and the topic query
parameter is true, this API produces a 2-way three dot diff.
This is the diff between source commit and the merge base of the source
commit and the destination commit. When the topic query param is false,
a simple git-style diff is produced.

The two commits are interpreted as follows:

  • First commit: the commit containing the changes we wish to preview
  • Second commit: the commit representing the state to which we want to
    compare the first commit
  • Note: This is the opposite of the order used in git diff.

Comparison to patches

While similar to patches, diffs:

  • Don’t have a commit header (username, commit message, etc)
  • Support the optional path=foo/bar.py query param to filter
    the diff to just that one file diff

Response

The raw diff is returned as-is, in whatever encoding the files in the
repository use. It is not decoded into unicode. As such, the
content-type is text/plain.

operationId: Commits_compareTwoCommitsDiff

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

spec path required string

A commit SHA (e.g. 3a8b42) or a commit range using double dot
notation (e.g. 3a8b42..9ff173).

workspace path required string

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

context query optional integer

Generate diffs with lines of context instead of the usual three.

path query optional string

Limit the diff to a particular file (this parameter
can be repeated for multiple paths).

ignore_whitespace query optional boolean

Generate diffs that ignore whitespace.

binary query optional boolean

Generate diffs that include binary files, true if omitted.

renames query optional boolean

Whether to perform rename detection, true if omitted.

merge query optional boolean

This parameter is deprecated. The ‘topic’ parameter should be used
instead. The ‘merge’ and ‘topic’ parameters cannot be both used at
the same time.

If true, the source commit is merged into the
destination commit, and then a diff from the
destination to the merge result is returned. If false,
a simple ‘two dot’ diff between the source and
destination is returned. True if omitted.

topic query optional boolean

If true, returns 2-way ‘three-dot’ diff.
This is a diff between the source commit and the merge base
of the source commit and the destination commit.
If false, a simple ‘two dot’ diff between the source and
destination is returned.

Responses

200

The raw diff

555

If the diff was too large and timed out.

Since this endpoint does not employ any form of pagination, but
instead returns the diff as a single document, it can run into
trouble on very large diffs. If Bitbucket times out in cases
like these, a 555 status code is returned.

GET /repositories/{workspace}/{repo_slug}/diff/{spec}
GET /repositories/{workspace}/{repo_slug}/diffstat/{spec}

Produces a response in JSON format with a record for every path
modified, including information on the type of the change and the
number of lines added and removed.

Single commit spec

If the spec argument to this API is a single commit, the diff is
produced against the first parent of the specified commit.

Two commit spec

Two commits separated by .. may be provided as the spec, e.g.,
3a8b42..9ff173. When two commits are provided and the topic query
parameter is true, this API produces a 2-way three dot diff.
This is the diff between source commit and the merge base of the source
commit and the destination commit. When the topic query param is false,
a simple git-style diff is produced.

The two commits are interpreted as follows:

  • First commit: the commit containing the changes we wish to preview
  • Second commit: the commit representing the state to which we want to
    compare the first commit
  • Note: This is the opposite of the order used in git diff.
operationId: Commits_compareDiffStats

Parameters

Name In Required Type Description
ignore_whitespace query optional boolean

Generate diffs that ignore whitespace

merge query optional boolean

This parameter is deprecated. The ‘topic’ parameter should be used
instead. The ‘merge’ and ‘topic’ parameters cannot be both used at
the same time.

If true, the source commit is merged into the
destination commit, and then a diffstat from the
destination to the merge result is returned. If false,
a simple ‘two dot’ diffstat between the source and
destination is returned. True if omitted.

path query optional string

Limit the diffstat to a particular file (this parameter
can be repeated for multiple paths).

renames query optional boolean

Whether to perform rename detection, true if omitted.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

spec path required string

A commit SHA (e.g. 3a8b42) or a commit range using double dot
notation (e.g. 3a8b42..9ff173).

topic query optional boolean

If true, returns 2-way ‘three-dot’ diff.
This is a diff between the source commit and the merge base
of the source commit and the destination commit.
If false, a simple ‘two dot’ diff between the source and
destination is returned.

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 diff stats

555

If generating the diffstat timed out.

GET /repositories/{workspace}/{repo_slug}/diffstat/{spec}
GET /repositories/{workspace}/{repo_slug}/merge-base/{revspec}

Returns the best common ancestor between two commits, specified in a revspec
of 2 commits (e.g. 3a8b42..9ff173).

If more than one best common ancestor exists, only one will be returned. It is
unspecified which will be returned.

operationId: Commits_getMergeBase

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

revspec path required string

A commit range using double dot notation (e.g. 3a8b42..9ff173).

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 merge base of the provided spec.

401

If the request was not authenticated.

403

If the authenticated user does not have access to any of the repositories specified.

404

If the repository or ref in the spec does not exist.

GET /repositories/{workspace}/{repo_slug}/merge-base/{revspec}
GET /repositories/{workspace}/{repo_slug}/patch/{spec}

Produces a raw patch for a single commit (diffed against its first
parent), or a patch-series for a revspec of 2 commits (e.g.
3a8b42..9ff173 where the first commit represents the source and the
second commit the destination).

In case of the latter (diffing a revspec), a patch series is returned
for the commits on the source branch (3a8b42 and its ancestors in
our example).

While similar to diffs, patches:

  • Have a commit header (username, commit message, etc)
  • Do not support the path=foo/bar.py query parameter

The raw patch is returned as-is, in whatever encoding the files in the
repository use. It is not decoded into unicode. As such, the
content-type is text/plain.

operationId: Commits_getPatchForCommits

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

spec path required string

A commit SHA (e.g. 3a8b42) or a commit range using double dot
notation (e.g. 3a8b42..9ff173).

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 raw patches

555

If the diff was too large and timed out.

Since this endpoint does not employ any form of pagination, but
instead returns the diff as a single document, it can run into
trouble on very large diffs. If Bitbucket times out in cases
like these, a 555 status code is returned.

GET /repositories/{workspace}/{repo_slug}/patch/{spec}

Deployments 8 endpoints

GET /repositories/{workspace}/{repo_slug}/deploy-keys

Returns all deploy-keys belonging to a repository.

operationId: Deployments_listRepositoryDeployKeys

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

Deploy keys matching the repository

403

If the specified user or repository is not accessible to the current user

404

If the specified user or repository does not exist

GET /repositories/{workspace}/{repo_slug}/deploy-keys
POST /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:

$ 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"
}'
operationId: Deployments_addRepositoryDeployKey

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 deploy key that was created

400

Invalid deploy key inputs

403

If the specified user or repository is not accessible to the current user

404

If the specified user or repository does not exist

POST /repositories/{workspace}/{repo_slug}/deploy-keys
DELETE /repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}

This deletes a deploy key from a repository.

operationId: Deployments_repositoryKeyDelete

Parameters

Name In Required Type Description
key_id path required string

The key ID matching the deploy key.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 key has been deleted

403

If the current user does not have permission to delete a key for the specified user

404

If the specified user, repository, or deploy key does not exist

DELETE /repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
GET /repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}

Returns the deploy key belonging to a specific key.

operationId: Deployments_getDeployKey

Parameters

Name In Required Type Description
key_id path required string

The key ID matching the deploy key.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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

Deploy key matching the key ID

403

If the specified user or repository is not accessible to the current user

404

If the specified user or repository does not exist

GET /repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
PUT /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:

$ 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",
}'
operationId: Deployments_updateRepositoryDeployKey

Parameters

Name In Required Type Description
key_id path required string

The key ID matching the deploy key.

repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository 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 newly updated deploy key.

400

If the submitted key or related value is invalid

403

If the current user does not have permission to add a key for the specified user

404

If the specified user, repository, or deploy key does not exist

PUT /repositories/{workspace}/{repo_slug}/deploy-keys/{key_id}
GET /repositories/{workspace}/{repo_slug}/deployments

Find deployments

operationId: Deployments_listDeployments

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 matching deployments.

GET /repositories/{workspace}/{repo_slug}/deployments
GET /repositories/{workspace}/{repo_slug}/deployments/{deployment_uuid}

Retrieve a deployment

operationId: Deployments_getSingleDeployment

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.

deployment_uuid path required string

The deployment UUID.

Responses

200

The deployment.

404

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

GET /repositories/{workspace}/{repo_slug}/deployments/{deployment_uuid}
GET /repositories/{workspace}/{repo_slug}/environments

Find environments

operationId: Deployments_listEnvironments

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 matching environments.

GET /repositories/{workspace}/{repo_slug}/environments

Schemas

object A_pull_request_task
{
  "allOf": [
    {
      "$ref": "#/components/schemas/task"
    },
    {
      "type": "object",
      "title": "Pull Request Task",
      "properties": {
        "links": {
          "type": "object",
          "properties": {
            "html": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            },
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        }
      },
      "description": "A pull request task."
    }
  ]
}
object A_pullrequest_comment_task
{
  "allOf": [
    {
      "$ref": "#/components/schemas/A_pull_request_task"
    },
    {
      "type": "object",
      "title": "Pull Request Comment Task",
      "properties": {
        "comment": {
          "$ref": "#/components/schemas/comment"
        }
      },
      "description": "A pullrequest comment task"
    }
  ]
}
object A_pullrequest_task_create
{
  "type": "object",
  "title": "Pull Request Task Create",
  "required": [
    "content"
  ],
  "properties": {
    "comment": {
      "$ref": "#/components/schemas/comment"
    },
    "content": {
      "type": "object",
      "title": "Task Raw Content",
      "required": [
        "raw"
      ],
      "properties": {
        "raw": {
          "type": "string",
          "description": "The task contents"
        }
      },
      "description": "task raw content"
    },
    "pending": {
      "type": "boolean"
    }
  },
  "description": "A pullrequest task create"
}
object A_pullrequest_task_update
{
  "type": "object",
  "title": "Pull Request Task Update",
  "properties": {
    "state": {
      "enum": [
        "RESOLVED",
        "UNRESOLVED"
      ],
      "type": "string"
    },
    "content": {
      "type": "object",
      "title": "Task Raw Content",
      "required": [
        "raw"
      ],
      "properties": {
        "raw": {
          "type": "string",
          "description": "The task contents"
        }
      },
      "description": "task raw content"
    }
  },
  "description": "A pullrequest task update"
}
array ReportsBulkCreateOrUpdateAnnotationsRequest
{
  "type": "array",
  "items": {
    "$ref": "#/components/schemas/report_annotation"
  },
  "maxItems": 100,
  "minItems": 1
}
array ReportsBulkCreateOrUpdateAnnotationsResponse
{
  "type": "array",
  "items": {
    "$ref": "#/components/schemas/report_annotation"
  }
}
object account
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Account",
      "properties": {
        "uuid": {
          "type": "string"
        },
        "links": {
          "$ref": "#/components/schemas/account_links"
        },
        "username": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_\\-]+$"
        },
        "created_on": {
          "type": "string",
          "format": "date-time"
        },
        "display_name": {
          "type": "string"
        }
      },
      "description": "An account object.",
      "additionalProperties": true
    }
  ]
}
object account_links
{
  "type": "object",
  "title": "Account Links",
  "properties": {
    "avatar": {
      "$ref": "#/components/schemas/link"
    }
  },
  "description": "Links related to an Account.",
  "additionalProperties": true
}
object app_user
{
  "allOf": [
    {
      "$ref": "#/components/schemas/account"
    },
    {
      "type": "object",
      "title": "App User",
      "properties": {
        "kind": {
          "type": "string",
          "description": "The kind of App User."
        },
        "account_id": {
          "type": "string",
          "description": "The user's Atlassian account ID."
        },
        "account_status": {
          "type": "string",
          "description": "The status of the account. Currently the only possible value is \"active\", but more values may be added in the future."
        }
      },
      "description": "An app user object.",
      "additionalProperties": true
    }
  ]
}
object application_property
{
  "type": "object",
  "title": "Application Property",
  "properties": {
    "_attributes": {
      "type": "array",
      "items": {
        "enum": [
          "public",
          "read_only"
        ],
        "type": "string"
      }
    }
  },
  "description": "An application property. It is a caller defined JSON object that Bitbucket will store and return. \nThe `_attributes` field at its top level can be used to control who is allowed to read and update the property. \nThe keys of the JSON object must match an allowed pattern. For details, \nsee [Application properties](https://dac-static.atlassian.com).\n",
  "additionalProperties": true
}
object author
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Author",
      "properties": {
        "raw": {
          "type": "string",
          "description": "The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket."
        },
        "user": {
          "$ref": "#/components/schemas/account"
        }
      },
      "description": "The author of a change in a repository",
      "additionalProperties": true
    }
  ]
}
object base_commit
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Base Commit",
      "properties": {
        "date": {
          "type": "string",
          "format": "date-time"
        },
        "hash": {
          "type": "string",
          "pattern": "[0-9a-f]{7,}?"
        },
        "author": {
          "$ref": "#/components/schemas/author"
        },
        "message": {
          "type": "string"
        },
        "parents": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/base_commit"
          },
          "minItems": 0
        },
        "summary": {
          "type": "object",
          "properties": {
            "raw": {
              "type": "string",
              "description": "The text as it was typed by a user."
            },
            "html": {
              "type": "string",
              "description": "The user's content rendered as HTML."
            },
            "markup": {
              "enum": [
                "markdown",
                "creole",
                "plaintext"
              ],
              "type": "string",
              "description": "The type of markup language the raw content is to be interpreted in."
            }
          }
        }
      },
      "description": "The common base type for both repository and snippet commits.",
      "additionalProperties": true
    }
  ]
}
object bitbucket.apps.permissions.serializers.ProjectPermissionUpdateSchema
{
  "type": "object",
  "required": [
    "permission"
  ],
  "properties": {
    "permission": {
      "enum": [
        "read",
        "write",
        "create-repo",
        "admin"
      ],
      "type": "string"
    }
  }
}
object bitbucket.apps.permissions.serializers.RepoPermissionUpdateSchema
{
  "type": "object",
  "required": [
    "permission"
  ],
  "properties": {
    "permission": {
      "enum": [
        "read",
        "write",
        "admin"
      ],
      "type": "string"
    }
  }
}
object branch
{
  "allOf": [
    {
      "$ref": "#/components/schemas/ref"
    },
    {
      "type": "object",
      "title": "Branch",
      "properties": {
        "merge_strategies": {
          "type": "array",
          "items": {
            "enum": [
              "merge_commit",
              "squash",
              "fast_forward"
            ],
            "type": "string"
          },
          "description": "Available merge strategies for pull requests targeting this branch."
        },
        "default_merge_strategy": {
          "type": "string",
          "description": "The default merge strategy for pull requests targeting this branch."
        }
      },
      "description": "A branch object, representing a branch in a repository.",
      "additionalProperties": true
    }
  ]
}
object branching_model
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Branching Model",
      "properties": {
        "production": {
          "type": "object",
          "required": [
            "name",
            "use_mainbranch"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
            },
            "branch": {
              "$ref": "#/components/schemas/branch"
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
            }
          }
        },
        "development": {
          "type": "object",
          "required": [
            "name",
            "use_mainbranch"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
            },
            "branch": {
              "$ref": "#/components/schemas/branch"
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
            }
          }
        },
        "branch_types": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "kind",
              "prefix"
            ],
            "properties": {
              "kind": {
                "enum": [
                  "feature",
                  "bugfix",
                  "release",
                  "hotfix"
                ],
                "type": "string",
                "description": "The kind of branch."
              },
              "prefix": {
                "type": "string",
                "description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The prefix must be a valid prefix for a branch and must always exist. It cannot be blank, empty or `null`."
              }
            }
          },
          "maxItems": 4,
          "minItems": 0,
          "description": "The active branch types.",
          "uniqueItems": true
        }
      },
      "description": "A repository's branching model",
      "additionalProperties": true
    }
  ]
}
object branching_model_settings
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Branching Model Settings",
      "properties": {
        "links": {
          "type": "object",
          "properties": {
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        },
        "production": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur."
            },
            "enabled": {
              "type": "boolean",
              "description": "Indicates if branch is enabled or not."
            },
            "is_valid": {
              "type": "boolean",
              "description": "Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings."
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name."
            }
          }
        },
        "development": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur."
            },
            "is_valid": {
              "type": "boolean",
              "description": "Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings."
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name."
            }
          }
        },
        "branch_types": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "enum": [
                  "feature",
                  "bugfix",
                  "release",
                  "hotfix"
                ],
                "type": "string",
                "description": "The kind of the branch type."
              },
              "prefix": {
                "type": "string",
                "description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The `prefix` of an enabled branch type must be a valid branch prefix.Additionally, it cannot be blank, empty or `null`. The `prefix` for a disabled branch type can be empty or invalid."
              },
              "enabled": {
                "type": "boolean",
                "description": "Whether the branch type is enabled or not. A disabled branch type may contain an invalid `prefix`."
              }
            }
          },
          "maxItems": 4,
          "minItems": 0,
          "uniqueItems": true
        }
      },
      "description": "A repository's branching model settings",
      "additionalProperties": true
    }
  ]
}
object branchrestriction
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Branch Restriction",
      "properties": {
        "users": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/account"
          },
          "minItems": 0
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/group"
          },
          "minItems": 0
        }
      },
      "description": "A branch restriction rule.",
      "additionalProperties": true
    }
  ]
}
object comment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Comment",
      "properties": {
        "id": {
          "type": "integer"
        },
        "user": {
          "$ref": "#/components/schemas/account"
        },
        "links": {
          "type": "object",
          "properties": {
            "code": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            },
            "html": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            },
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        },
        "inline": {
          "type": "object",
          "required": [
            "path"
          ],
          "properties": {
            "to": {
              "type": "integer",
              "minimum": 1,
              "description": "The comment's anchor line in the new version of the file. If the 'from' line is also provided, this value will be removed."
            },
            "from": {
              "type": "integer",
              "minimum": 1,
              "description": "The comment's anchor line in the old version of the file."
            },
            "path": {
              "type": "string",
              "description": "The path of the file this comment is anchored to."
            }
          }
        },
        "parent": {
          "$ref": "#/components/schemas/comment"
        },
        "content": {
          "type": "object",
          "properties": {
            "raw": {
              "type": "string",
              "description": "The text as it was typed by a user."
            },
            "html": {
              "type": "string",
              "description": "The user's content rendered as HTML."
            },
            "markup": {
              "enum": [
                "markdown",
                "creole",
                "plaintext"
              ],
              "type": "string",
              "description": "The type of markup language the raw content is to be interpreted in."
            }
          }
        },
        "deleted": {
          "type": "boolean"
        },
        "created_on": {
          "type": "string",
          "format": "date-time"
        },
        "updated_on": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "The base type for all comments. This type should be considered abstract. Each of the \"commentable\" resources defines its own subtypes (e.g. `issue_comment`).",
      "additionalProperties": true
    }
  ]
}
object comment_resolution
{
  "type": "object",
  "title": "Comment Resolution",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string"
    },
    "user": {
      "$ref": "#/components/schemas/account"
    },
    "created_on": {
      "type": "string",
      "format": "date-time",
      "description": "The ISO8601 timestamp the resolution was created."
    }
  },
  "description": "The resolution object for a Comment.",
  "additionalProperties": true
}
object commit
{
  "allOf": [
    {
      "$ref": "#/components/schemas/base_commit"
    },
    {
      "type": "object",
      "title": "Commit",
      "properties": {
        "repository": {
          "$ref": "#/components/schemas/repository"
        },
        "participants": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/participant"
          },
          "minItems": 0
        }
      },
      "description": "A repository commit object.",
      "additionalProperties": true
    }
  ]
}
object commit_comment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/comment"
    },
    {
      "type": "object",
      "title": "Commit Comment",
      "properties": {
        "commit": {
          "$ref": "#/components/schemas/commit"
        }
      },
      "description": "A commit comment.",
      "additionalProperties": true
    }
  ]
}
object commit_file
{
  "type": "object",
  "title": "Commit File",
  "required": [
    "type"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "The path in the repository"
    },
    "type": {
      "type": "string"
    },
    "commit": {
      "$ref": "#/components/schemas/commit"
    },
    "attributes": {
      "enum": [
        "link",
        "executable",
        "subrepository",
        "binary",
        "lfs"
      ],
      "type": "string"
    },
    "escaped_path": {
      "type": "string",
      "description": "The escaped version of the path as it appears in a diff. If the path does not require escaping this will be the same as path."
    }
  },
  "description": "A file object, representing a file at a commit in a repository",
  "additionalProperties": true
}
object commitstatus
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Commit Status",
      "properties": {
        "key": {
          "type": "string",
          "description": "An identifier for the status that's unique to\n        its type (current \"build\" is the only supported type) and the vendor,\n        e.g. BB-DEPLOY"
        },
        "url": {
          "type": "string",
          "description": "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."
        },
        "name": {
          "type": "string",
          "description": "An identifier for the build itself, e.g. BB-DEPLOY-1"
        },
        "uuid": {
          "type": "string",
          "description": "The commit status' id."
        },
        "links": {
          "type": "object",
          "properties": {
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            },
            "commit": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        },
        "state": {
          "enum": [
            "FAILED",
            "INPROGRESS",
            "STOPPED",
            "SUCCESSFUL"
          ],
          "type": "string",
          "description": "Provides some indication of the status of this commit"
        },
        "refname": {
          "type": "string",
          "description": "\nThe name of the ref that pointed to this commit at the time the status\nobject was created. Note that this the ref may since have moved off of\nthe commit. This optional field can be useful for build systems whose\nbuild triggers and configuration are branch-dependent (e.g. a Pipeline\nbuild).\nIt is legitimate for this field to not be set, or even apply (e.g. a\nstatic linting job)."
        },
        "created_on": {
          "type": "string",
          "format": "date-time"
        },
        "updated_on": {
          "type": "string",
          "format": "date-time"
        },
        "description": {
          "type": "string",
          "description": "A description of the build (e.g. \"Unit tests in Bamboo\")"
        }
      },
      "description": "A commit status object.",
      "additionalProperties": true
    }
  ]
}
object component
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Component",
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "links": {
          "type": "object",
          "properties": {
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        }
      },
      "description": "A component as defined in a repository's issue tracker.",
      "additionalProperties": true
    }
  ]
}
object ddev_report
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "description": "A report for a commit.",
      "additionalProperties": true
    }
  ],
  "x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/commits/{commitHash}/reports/{uuid}",
  "x-bb-default-fields": [
    "uuid",
    "commitHash"
  ]
}
object default_reviewer_and_type
{
  "type": "object",
  "title": "Default Reviewer and Type",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string"
    },
    "user": {
      "$ref": "#/components/schemas/user"
    },
    "reviewer_type": {
      "type": "string"
    }
  },
  "description": "Object containing a user that is a default reviewer and the type of reviewer",
  "additionalProperties": true
}
object deploy_key
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deploy Key",
      "properties": {
        "key": {
          "type": "string",
          "description": "The deploy key value."
        },
        "label": {
          "type": "string",
          "description": "The user-defined label for the deploy key"
        },
        "links": {
          "type": "object",
          "properties": {
            "self": {
              "type": "object",
              "title": "Link",
              "properties": {
                "href": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "description": "A link to a resource related to this object."
            }
          }
        },
        "owner": {
          "$ref": "#/components/schemas/account"
        },
        "comment": {
          "type": "string",
          "description": "The comment parsed from the deploy key (if present)"
        },
        "added_on": {
          "type": "string",
          "format": "date-time"
        },
        "last_used": {
          "type": "string",
          "format": "date-time"
        },
        "repository": {
          "$ref": "#/components/schemas/repository"
        }
      },
      "description": "Represents deploy key for a repository.",
      "additionalProperties": true
    }
  ]
}
object deployment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment",
      "properties": {
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the deployment."
        },
        "state": {
          "$ref": "#/components/schemas/deployment_state"
        },
        "release": {
          "$ref": "#/components/schemas/deployment_release"
        },
        "environment": {
          "$ref": "#/components/schemas/deployment_environment"
        }
      },
      "description": "A Bitbucket Deployment.",
      "additionalProperties": true
    }
  ]
}
object deployment_environment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the environment."
        },
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment.",
      "additionalProperties": true
    }
  ],
  "x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "uuid"
  ]
}
object deployment_environment_lock
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment Lock",
      "properties": {
        "environmentUuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment Lock.",
      "additionalProperties": true
    }
  ],
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "*",
    "lock_opener.*",
    "owner.*"
  ]
}
object deployment_release
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Release",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Link to the pipeline that produced the release."
        },
        "name": {
          "type": "string",
          "description": "The name of the release."
        },
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the release."
        },
        "commit": {
          "$ref": "#/components/schemas/commit"
        },
        "created_on": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp when the release was created."
        }
      },
      "description": "A Bitbucket Deployment Release.",
      "additionalProperties": true
    }
  ]
}
object deployment_state
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment State",
      "properties": {},
      "description": "The representation of the progress state of a deployment.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_completed
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state"
    },
    {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Link to the deployment result."
        },
        "name": {
          "enum": [
            "COMPLETED"
          ],
          "type": "string",
          "description": "The name of deployment state (COMPLETED)."
        },
        "status": {
          "$ref": "#/components/schemas/deployment_state_completed_status"
        },
        "deployer": {
          "$ref": "#/components/schemas/account"
        },
        "start_date": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp when the deployment was started."
        },
        "completion_date": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp when the deployment completed."
        }
      },
      "description": "A Bitbucket Deployment COMPLETED deployment state.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_completed_status
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Completed Deployment",
      "properties": {},
      "description": "The status of a completed deployment.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_completed_status_failed
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state_completed_status"
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "enum": [
            "FAILED"
          ],
          "type": "string",
          "description": "The name of the completed deployment status (FAILED)."
        }
      },
      "description": "A FAILED completed deployment status.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_completed_status_stopped
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state_completed_status"
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "enum": [
            "STOPPED"
          ],
          "type": "string",
          "description": "The name of the completed deployment status (STOPPED)."
        }
      },
      "description": "A STOPPED completed deployment status.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_completed_status_successful
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state_completed_status"
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "enum": [
            "SUCCESSFUL"
          ],
          "type": "string",
          "description": "The name of the completed deployment status (SUCCESSFUL)."
        }
      },
      "description": "A SUCCESSFUL completed deployment status.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_in_progress
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state"
    },
    {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Link to the deployment result."
        },
        "name": {
          "enum": [
            "IN_PROGRESS"
          ],
          "type": "string",
          "description": "The name of deployment state (IN_PROGRESS)."
        },
        "deployer": {
          "$ref": "#/components/schemas/account"
        },
        "start_date": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp when the deployment was started."
        }
      },
      "description": "A Bitbucket Deployment IN_PROGRESS deployment state.",
      "additionalProperties": true
    }
  ]
}
object deployment_state_undeployed
{
  "allOf": [
    {
      "$ref": "#/components/schemas/deployment_state"
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "enum": [
            "UNDEPLOYED"
          ],
          "type": "string",
          "description": "The name of deployment state (UNDEPLOYED)."
        },
        "trigger_url": {
          "type": "string",
          "format": "uri",
          "description": "Link to trigger the deployment."
        }
      },
      "description": "A Bitbucket Deployment UNDEPLOYED deployment state.",
      "additionalProperties": true
    }
  ]
}
object deployment_variable
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Variable",
      "properties": {
        "key": {
          "type": "string",
          "description": "The unique name of the variable."
        },
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the variable."
        },
        "value": {
          "type": "string",
          "description": "The value of the variable. If the variable is secured, this will be empty."
        },
        "secured": {
          "type": "boolean",
          "description": "If true, this variable will be treated as secured. The value will never be exposed in the logs or the REST API."
        }
      },
      "description": "A Pipelines deployment variable.",
      "additionalProperties": true
    }
  ]
}
object deployments_ddev_deployment_environment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the environment."
        },
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment.",
      "additionalProperties": true
    }
  ],
  "x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "uuid"
  ]
}
object deployments_ddev_deployment_environment_lock
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment Lock",
      "properties": {
        "environmentUuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment Lock.",
      "additionalProperties": true
    }
  ],
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "*",
    "lock_opener.*",
    "owner.*"
  ]
}
object deployments_ddev_paginated_environments
{
  "type": "object",
  "title": "Paginated Deployment Environments",
  "properties": {
    "next": {
      "type": "string",
      "format": "uri",
      "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs."
    },
    "page": {
      "type": "integer",
      "description": "Page number of the current results. This is an optional element that is not provided in all responses."
    },
    "size": {
      "type": "integer",
      "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute."
    },
    "values": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/deployments_ddev_deployment_environment"
      },
      "minItems": 0,
      "description": "The values of the current page."
    },
    "pagelen": {
      "type": "integer",
      "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values."
    },
    "previous": {
      "type": "string",
      "format": "uri",
      "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs."
    }
  },
  "description": "A paged list of environments"
}
object deployments_stg_west_deployment_environment
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the environment."
        },
        "uuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment.",
      "additionalProperties": true
    }
  ],
  "x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "uuid"
  ]
}
object deployments_stg_west_deployment_environment_lock
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Deployment Environment Lock",
      "properties": {
        "environmentUuid": {
          "type": "string",
          "description": "The UUID identifying the environment."
        }
      },
      "description": "A Bitbucket Deployment Environment Lock.",
      "additionalProperties": true
    }
  ],
  "x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
  "x-bb-batch-max-size": 100,
  "x-bb-default-fields": [
    "*",
    "lock_opener.*",
    "owner.*"
  ]
}
object deployments_stg_west_paginated_environments
{
  "type": "object",
  "title": "Paginated Deployment Environments",
  "properties": {
    "next": {
      "type": "string",
      "format": "uri",
      "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs."
    },
    "page": {
      "type": "integer",
      "description": "Page number of the current results. This is an optional element that is not provided in all responses."
    },
    "size": {
      "type": "integer",
      "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute."
    },
    "values": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/deployments_stg_west_deployment_environment"
      },
      "minItems": 0,
      "description": "The values of the current page."
    },
    "pagelen": {
      "type": "integer",
      "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values."
    },
    "previous": {
      "type": "string",
      "format": "uri",
      "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs."
    }
  },
  "description": "A paged list of environments"
}
object diffstat
{
  "type": "object",
  "title": "Diff Stat",
  "required": [
    "type"
  ],
  "properties": {
    "new": {
      "$ref": "#/components/schemas/commit_file"
    },
    "old": {
      "$ref": "#/components/schemas/commit_file"
    },
    "type": {
      "type": "string"
    },
    "status": {
      "enum": [
        "added",
        "removed",
        "modified",
        "renamed"
      ],
      "type": "string"
    },
    "lines_added": {
      "type": "integer"
    },
    "lines_removed": {
      "type": "integer"
    }
  },
  "description": "A diffstat object that includes a summary of changes made to a file between two commits.",
  "additionalProperties": true
}
object effective_repo_branching_model
{
  "allOf": [
    {
      "$ref": "#/components/schemas/object"
    },
    {
      "type": "object",
      "title": "Effective Repository Branching Model",
      "properties": {
        "production": {
          "type": "object",
          "required": [
            "name",
            "use_mainbranch"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
            },
            "branch": {
              "$ref": "#/components/schemas/branch"
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
            }
          }
        },
        "development": {
          "type": "object",
          "required": [
            "name",
            "use_mainbranch"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
            },
            "branch": {
              "$ref": "#/components/schemas/branch"
            },
            "use_mainbranch": {
              "type": "boolean",
              "description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
            }
          }
        },
        "branch_types": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "kind",
              "prefix"
            ],
            "properties": {
              "kind": {
                "enum": [
                  "feature",
                  "bugfix",
                  "release",
                  "hotfix"
                ],
                "type": "string",
                "description": "The kind of branch."
              },
              "prefix": {
                "type": "string",
                "description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The prefix must be a valid prefix for a branch and must always exist. It cannot be blank, empty or `null`."
              }
            }
          },
          "maxItems": 4,
          "minItems": 0,
          "description": "The active branch types.",
          "uniqueItems": true
        }
      },
      "description": "A repository's effective branching model",
      "additionalProperties": true
    }
  ]
}
object error
{
  "type": "object",
  "title": "Error",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string"
    },
    "error": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "data": {
          "type": "object",
          "properties": {},
          "description": "Optional structured data that is endpoint-specific.",
          "additionalProperties": true
        },
        "detail": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  },
  "description": "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`.",
  "additionalProperties": true
}

Versions

Version Endpoints Schemas Ingested Status
2.0 318 216 2026-05-11 current
2.0 318 216 2026-04-16