Bitbucket API
Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework.
- Homepage
- https://api.apis.guru/v2/specs/bitbucket.org/2.0.json
- Provider
- bitbucket.org
- OpenAPI version
- 3.0.0
- Spec (JSON)
- https://api.apis.guru/v2/specs/bitbucket.org/2.0/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/bitbucket.org/2.0/openapi.yaml
Tools (305)
Extracted live via the executor SDK.
-
addon.deleteAddonDeletes 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.
-
addon.deleteAddonLinkersLinkerKeyValuesDelete all values for the specified linker of the authenticated application.
-
addon.deleteAddonLinkersLinkerKeyValuesValueIdDelete a single value of the authenticated application.
-
addon.getAddonLinkersGets a list of all for the authenticated application.
-
addon.getAddonLinkersLinkerKeyGets a specified by
linker_keyfor the authenticated application. -
addon.getAddonLinkersLinkerKeyValuesGets a list of all 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. -
addon.getAddonLinkersLinkerKeyValuesValueIdGet a single value of the authenticated application.
-
addon.postAddonLinkersLinkerKeyValuesCreates a 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. -
addon.putAddonUpdates 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.
The new
descriptorfor the installation can be also provided in the body directly.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.The
descriptor_urlmust 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.
$ curl -X PUT https://api.bitbucket.org/2.0/addon \ -H "Authorization: JWT <JWT Token>" \ --header "Content-Type: application/json" \ --data '{}'$ curl -X PUT https://api.bitbucket.org/2.0/addon \ -H "Authorization: JWT <JWT Token>" \ --header "Content-Type: application/json" \ --data '{"descriptor": $NEW_DESCRIPTOR}'$ 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}' -
addon.putAddonLinkersLinkerKeyValuesBulk update 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. -
branchingModel.getRepositoriesWorkspaceRepoSlugBranchingModelReturn the branching model as applied to the repository. This view is read-only. The branching model settings can be changed using the API.
The returned object:
- Always has a
developmentproperty.development.branchcontains the actual repository branch object that is considered to be thedevelopmentbranch.development.branchwill not be present if it does not exist. - Might have a
productionproperty.productionwill not be present whenproductionis disabled.production.branchcontains the actual branch object that is considered to be theproductionbranch.production.branchwill not be present if it does not exist. - Always has a
branch_typesarray which contains all enabled branch types.
Example body:
{ "development": { "name": "master", "branch": { "type": "branch", "name": "master", "target": { "hash": "16dffcb0de1b22e249db6799532074cf32efe80f" } }, "use_mainbranch": true }, "production": { "name": "production", "branch": { "type": "branch", "name": "production", "target": { "hash": "16dffcb0de1b22e249db6799532074cf32efe80f" } }, "use_mainbranch": false }, "branch_types": [ { "kind": "release", "prefix": "release/" }, { "kind": "hotfix", "prefix": "hotfix/" }, { "kind": "feature", "prefix": "feature/" }, { "kind": "bugfix", "prefix": "bugfix/" } ], "type": "branching_model", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model" } }} - Always has a
-
branchingModel.getRepositoriesWorkspaceRepoSlugBranchingModelSettingsReturn the branching model configuration for a repository. The returned object:
- Always has a
developmentproperty for the development branch. - Always a
productionproperty for the production branch. The production branch can be disabled. - The
branch_typescontains 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 more useful.
Example body:
{ "development": { "is_valid": true, "name": null, "use_mainbranch": true }, "production": { "is_valid": true, "name": "production", "use_mainbranch": false, "enabled": false }, "branch_types": [ { "kind": "release", "enabled": true, "prefix": "release/" }, { "kind": "hotfix", "enabled": true, "prefix": "hotfix/" }, { "kind": "feature", "enabled": true, "prefix": "feature/" }, { "kind": "bugfix", "enabled": false, "prefix": "bugfix/" } ], "type": "branching_model_settings", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model/settings" } }} - Always has a
-
branchingModel.getRepositoriesWorkspaceRepoSlugEffectiveBranchingModel -
branchingModel.getWorkspacesWorkspaceProjectsProjectKeyBranchingModelReturn the branching model set at the project level. This view is read-only. The branching model settings can be changed using the API.
The returned object:
- Always has a
developmentproperty.development.nameis the user-specified branch that can be inherited by an individual repository's branching model. - Might have a
productionproperty.productionwill not be present whenproductionis disabled.production.nameis the user-specified branch that can be inherited by an individual repository's branching model. - Always has a
branch_typesarray which contains all enabled branch types.
Example body:
{ "development": { "name": "master", "use_mainbranch": true }, "production": { "name": "production", "use_mainbranch": false }, "branch_types": [ { "kind": "release", "prefix": "release/" }, { "kind": "hotfix", "prefix": "hotfix/" }, { "kind": "feature", "prefix": "feature/" }, { "kind": "bugfix", "prefix": "bugfix/" } ], "type": "project_branching_model", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model" } }} - Always has a
-
branchingModel.getWorkspacesWorkspaceProjectsProjectKeyBranchingModelSettingsReturn the branching model configuration for a project. The returned object:
- Always has a
developmentproperty for the development branch. - Always a
productionproperty for the production branch. The production branch can be disabled. - The
branch_typescontains 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 more useful.
Example body:
{ "development": { "name": null, "use_mainbranch": true }, "production": { "name": "production", "use_mainbranch": false, "enabled": false }, "branch_types": [ { "kind": "release", "enabled": true, "prefix": "release/" }, { "kind": "hotfix", "enabled": true, "prefix": "hotfix/" }, { "kind": "feature", "enabled": true, "prefix": "feature/" }, { "kind": "bugfix", "enabled": false, "prefix": "bugfix/" } ], "type": "branching_model_settings", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model/settings" } }} - Always has a
-
branchingModel.putRepositoriesWorkspaceRepoSlugBranchingModelSettingsUpdate the branching model configuration for a repository.
The
developmentbranch 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 adevelopmentproperty will leave the development branch unchanged.It is possible for the
developmentbranch to be invalid. This happens when it points at a specific branch that has been deleted. This is indicated in theis_validfield for the branch. It is not possible to update the settings fordevelopmentif that would leave the branch in an invalid state. Such a request will be rejected.The
productionbranch can be a specific branch, the main branch or disabled. When set to a specific branch it must currently exist. Theenabledproperty 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 aproductionproperty will leave the production branch unchanged.It is possible for the
productionbranch to be invalid. This happens when it points at a specific branch that has been deleted. This is indicated in theis_validfield for the branch. A request that would leaveproductionenabled and invalid will be rejected. It is possible to updateproductionand make it invalid if it would also be left disabled.The
branch_typesproperty 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:- The prefixes for all enabled branch types are valid. For example, it is not possible to use '*' inside a Git prefix.
- 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
kindproperty to identify it.Example Body:
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.*
{ "development": { "use_mainbranch": true }, "production": { "enabled": true, "use_mainbranch": false, "name": "production" }, "branch_types": [ { "kind": "bugfix", "enabled": true, "prefix": "bugfix/" }, { "kind": "feature", "enabled": true, "prefix": "feature/" }, { "kind": "hotfix", "prefix": "hotfix/" }, { "kind": "release", "enabled": false, } ] } -
branchingModel.putWorkspacesWorkspaceProjectsProjectKeyBranchingModelSettingsUpdate the branching model configuration for a project.
The
developmentbranch 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 adevelopmentproperty will leave the development branch unchanged.The
productionbranch 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. Theenabledproperty 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 aproductionproperty will leave the production branch unchanged.The
branch_typesproperty 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:- The prefixes for all enabled branch types are valid. For example, it is not possible to use '*' inside a Git prefix.
- 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
kindproperty to identify it.Example Body:
{ "development": { "use_mainbranch": true }, "production": { "enabled": true, "use_mainbranch": false, "name": "production" }, "branch_types": [ { "kind": "bugfix", "enabled": true, "prefix": "bugfix/" }, { "kind": "feature", "enabled": true, "prefix": "feature/" }, { "kind": "hotfix", "prefix": "hotfix/" }, { "kind": "release", "enabled": false, } ] }```* -
branchRestrictions.deleteRepositoriesWorkspaceRepoSlugBranchRestrictionsIdDeletes an existing branch restriction rule.
-
branchRestrictions.getRepositoriesWorkspaceRepoSlugBranchRestrictionsReturns a paginated list of all branch restrictions on the repository.
-
branchRestrictions.getRepositoriesWorkspaceRepoSlugBranchRestrictionsIdReturns a specific branch restriction rule.
-
branchRestrictions.postRepositoriesWorkspaceRepoSlugBranchRestrictionsCreates a new branch restriction rule for a repository.
kinddescribes what will be restricted. Allowed values include:push,force,deleteandrestrict_merges.Different kinds of branch restrictions have different requirements:
pushandrestrict_mergesrequireusersandgroupsto 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:glob: Matches a branch against thepattern. A'*'inpatternwill 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.branching_model: Matches a branch against the repository's branching model. Thebranch_typecontrols the type of branch to match. Allowed values include:production,development,bugfix,release,featureandhotfix.
The combination of
kindand match must be unique. This means that twoglobrestrictions in a repository cannot have the samekindandpattern. Additionally, twobranching_modelrestrictions in a repository cannot have the samekindandbranch_type.usersandgroupsare lists of users and groups that are except from the restriction. They can only be configured inpushandrestrict_mergesrestrictions. Thepushrestriction stops a user pushing to matching branches unless that user is inusersor is a member of a group ingroups. Therestrict_mergesstops a user merging pull requests to matching branches unless that user is inusersor is a member of a group ingroups. Adding new users or groups to an existing restriction should be done viaPUT.Note that branch restrictions with overlapping matchers is allowed, but the resulting behavior may be surprising.
-
branchRestrictions.putRepositoriesWorkspaceRepoSlugBranchRestrictionsIdUpdates an existing branch restriction rule.
Fields not present in the request body are ignored.
See for details.
-
commits.deleteRepositoriesWorkspaceRepoSlugCommitCommitApproveRedact 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.
-
commits.deleteRepositoriesWorkspaceRepoSlugCommitCommitCommentsCommentIdDeletes 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
deletedelement is set totrueand the content is blanked out. The comment will continue to be returned by the collections and self endpoints. -
commits.getRepositoriesWorkspaceRepoSlugCommitCommitReturns the specified commit.
Example:
$ curl https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a1{ "rendered": { "message": { "raw": "Add a GEORDI_OUTPUT_DIR setting", "markup": "markdown", "html": "<p>Add a GEORDI_OUTPUT_DIR setting</p>", "type": "rendered" } }, "hash": "f7591a13eda445d9a9167f98eb870319f4b6c2d8", "repository": { "name": "geordi", "type": "repository", "full_name": "bitbucket/geordi", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi" }, "html": { "href": "https://bitbucket.org/bitbucket/geordi" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B85d08b4e-571d-44e9-a507-fa476535aa98%7D?ts=1730260" } }, "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8" }, "comments": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/comments" }, "patch": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/patch/f7591a13eda445d9a9167f98eb870319f4b6c2d8" }, "html": { "href": "https://bitbucket.org/bitbucket/geordi/commits/f7591a13eda445d9a9167f98eb870319f4b6c2d8" }, "diff": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/diff/f7591a13eda445d9a9167f98eb870319f4b6c2d8" }, "approve": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/approve" }, "statuses": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/statuses" } }, "author": { "raw": "Brodie Rao <a@b.c>", "type": "author", "user": { "display_name": "Brodie Rao", "uuid": "{9484702e-c663-4afd-aefb-c93a8cd31c28}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B9484702e-c663-4afd-aefb-c93a8cd31c28%7D" }, "html": { "href": "https://bitbucket.org/%7B9484702e-c663-4afd-aefb-c93a8cd31c28%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:3aae1e05-702a-41e5-81c8-f36f29afb6ca/613070db-28b0-421f-8dba-ae8a87e2a5c7/128" } }, "type": "user", "nickname": "brodie", "account_id": "557058:3aae1e05-702a-41e5-81c8-f36f29afb6ca" } }, "summary": { "raw": "Add a GEORDI_OUTPUT_DIR setting", "markup": "markdown", "html": "<p>Add a GEORDI_OUTPUT_DIR setting</p>", "type": "rendered" }, "participants": [], "parents": [ { "type": "commit", "hash": "f06941fec4ef6bcb0c2456927a0cf258fa4f899b", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f06941fec4ef6bcb0c2456927a0cf258fa4f899b" }, "html": { "href": "https://bitbucket.org/bitbucket/geordi/commits/f06941fec4ef6bcb0c2456927a0cf258fa4f899b" } } } ], "date": "2012-07-16T19:37:54+00:00", "message": "Add a GEORDI_OUTPUT_DIR setting", "type": "commit"} -
commits.getRepositoriesWorkspaceRepoSlugCommitCommitCommentsReturns the commit's comments.
This includes both global and inline comments.
The default sorting is oldest to newest and can be overridden with the
sortquery parameter. -
commits.getRepositoriesWorkspaceRepoSlugCommitCommitCommentsCommentIdReturns the specified commit comment.
-
commits.getRepositoriesWorkspaceRepoSlugCommitsThese 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
fooorbar, but not onfuorfubar(similar togit log foo bar ^fu ^fubar).An optional
pathparameter can be specified that will limit the results to commits that affect that path.pathcan 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 bypath. It is important to note that if thepathparameter 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
fooorbar, but not onmasterthat 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
fooorbar, but not onmasterthat 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-urlencodedPOST instead. -
commits.getRepositoriesWorkspaceRepoSlugCommitsRevisionThese 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 togit log master).GET /repositories/{workspace}/{repo_slug}/commits/dev?include=foo&exclude=master
Returns all commits on ref
devorfoo, except those that are reachable onmaster(similar togit log dev foo ^master).An optional
pathparameter can be specified that will limit the results to commits that affect that path.pathcan 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 bypath. It is important to note that if thepathparameter 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
devorfooorbar, but not onmasterthat 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
devorfoo, but not onmasterthat 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-urlencodedPOST instead. -
commits.getRepositoriesWorkspaceRepoSlugDiffSpecProduces a raw git-style diff.
Single commit spec
If the
specargument 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 thespec, e.g.,3a8b42..9ff173. When two commits are provided and thetopicquery parameter is true or absent, 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 thetopicquery 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.pyquery 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. -
commits.getRepositoriesWorkspaceRepoSlugDiffstatSpecProduces 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
specargument 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 thespec, e.g.,3a8b42..9ff173. When two commits are provided and thetopicquery parameter is true or absent, 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 thetopicquery 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.
Sample output
curl https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/diffstat/d222fa2..e174964{ "pagelen": 500, "values": [ { "type": "diffstat", "status": "modified", "lines_removed": 1, "lines_added": 2, "old": { "path": "setup.py", "escaped_path": "setup.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/src/e1749643d655d7c7014001a6c0f58abaf42ad850/setup.py" } } }, "new": { "path": "setup.py", "escaped_path": "setup.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/src/d222fa235229c55dad20b190b0b571adf737d5a6/setup.py" } } } } ], "page": 1, "size": 1} -
commits.getRepositoriesWorkspaceRepoSlugMergeBaseRevspecReturns 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.
-
commits.getRepositoriesWorkspaceRepoSlugPatchSpecProduces 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..9ff173where 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 (
3a8b42and 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.pyquery 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. -
commits.postRepositoriesWorkspaceRepoSlugCommitCommitApproveApprove 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.
-
commits.postRepositoriesWorkspaceRepoSlugCommitCommitCommentsCreates new comment on the specified commit.
To post a reply to an existing comment, include the
parent.idfield: -
commits.postRepositoriesWorkspaceRepoSlugCommitsIdentical 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.
-
commits.postRepositoriesWorkspaceRepoSlugCommitsRevisionIdentical 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.
-
commits.putRepositoriesWorkspaceRepoSlugCommitCommitCommentsCommentIdUsed to update the contents of a comment. Only the content of the comment can be updated.
-
commitStatuses.getRepositoriesWorkspaceRepoSlugCommitCommitStatusesReturns all statuses (e.g. build results) for a specific commit.
-
commitStatuses.getRepositoriesWorkspaceRepoSlugCommitCommitStatusesBuildKeyReturns the specified build status for a commit.
-
commitStatuses.postRepositoriesWorkspaceRepoSlugCommitCommitStatusesBuildCreates a new build status against the specified commit.
If the specified key already exists, the existing status object will be overwritten.
Example:
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 . For example, one could use
https://foo.com/builds/{repository.full_name}which Bitbucket will turn intohttps://foo.com/builds/foo/barat render time. The context variables available arerepositoryandcommit. -
commitStatuses.putRepositoriesWorkspaceRepoSlugCommitCommitStatusesBuildKeyUsed 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:
statenamedescriptionurlrefname
The
keycannot be changed. -
deployments.createEnvironmentCreate an environment.
-
deployments.deleteEnvironmentForRepositoryDelete an environment
-
deployments.deleteRepositoriesWorkspaceRepoSlugDeployKeysKeyIdThis deletes a deploy key from a repository.
Example:
-
deployments.deleteWorkspacesWorkspaceProjectsProjectKeyDeployKeysKeyIdThis deletes a deploy key from a project.
Example:
-
deployments.getDeploymentForRepositoryRetrieve a deployment
-
deployments.getDeploymentsForRepositoryFind deployments
-
deployments.getEnvironmentForRepositoryRetrieve an environment
-
deployments.getEnvironmentsForRepositoryFind environments
-
deployments.getRepositoriesWorkspaceRepoSlugDeployKeysReturns all deploy-keys belonging to a repository.
Example:
$ curl -H "Authorization <auth header>" \https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys Output:{ "pagelen": 10, "values": [ { "id": 123, "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5", "label": "mykey", "type": "deploy_key", "created_on": "2018-08-15T23:50:59.993890+00:00", "repository": { "full_name": "mleu/test", "name": "test", "type": "repository", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "links":{ "self":{ "href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/123" } } "last_used": null, "comment": "mleu@C02W454JHTD8" } ], "page": 1, "size": 1} -
deployments.getRepositoriesWorkspaceRepoSlugDeployKeysKeyIdReturns the deploy key belonging to a specific key.
Example:
$ curl -H "Authorization <auth header>" \https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-key/1234 Output:{ "comment": "mleu@C02W454JHTD8", "last_used": null, "links": { "self": { "href": https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-key/1234" } }, "repository": { "full_name": "mleu/test", "name": "test", "type": "repository", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "label": "mykey", "created_on": "2018-08-15T23:50:59.993890+00:00", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5", "id": 1234, "type": "deploy_key"} -
deployments.getWorkspacesWorkspaceProjectsProjectKeyDeployKeysReturns all deploy keys belonging to a project.
Example:
$ curl -H "Authorization <auth header>" \https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys Output:{ "pagelen":10, "values":[ { "comment":"thakseth@C02W454JHTD8", "last_used":null, "links":{ "self":{ "href":"https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/1234" } }, "label":"test", "project":{ "links":{ "self":{ "href":"https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT" } }, "type":"project", "name":"cooperative standard", "key":"TEST_PROJECT", "uuid":"{3b3e510b-7f2b-414d-a2b7-76c4e405c1c0}" }, "created_on":"2021-07-28T21:20:19.491721+00:00", "key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX5yfMOEw6HG9jKTYTisbmDTJ4MCUTSVGr5e4OWvY3UuI2A6F8SdzQqa2f5BABA/4g5Sk5awJrYHlNu3EzV1V2I44tR3A4fnZAG71ZKyDPi1wvdO7UYmFgxV/Vd18H9QZFFjICGDM7W0PT2mI0kON/jN3qNWi+GiB/xgaeQKSqynysdysDp8lnnI/8Sh3ikURP9UP83ShRCpAXszOUNaa+UUlcYQYBDLIGowsg51c4PCkC3DNhAMxppkNRKoSOWwyl+oRVXHSDylkiJSBHW3HH4Q6WHieD54kGrjbhWBKdnnxKX7QAAZBDseY+t01N36m6/ljvXSUEcBWtHxBYye0r", "type":"project_deploy_key", "id":1234 } ], "page":1, "size":1} -
deployments.getWorkspacesWorkspaceProjectsProjectKeyDeployKeysKeyIdReturns the deploy key belonging to a specific key ID.
Example:
$ curl -H "Authorization <auth header>" \https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/1234 Output:{ "pagelen":10, "values":[ { "comment":"thakseth@C02W454JHTD8", "last_used":null, "links":{ "self":{ "href":"https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/1234" } }, "label":"test", "project":{ "links":{ "self":{ "href":"https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT" } }, "type":"project", "name":"cooperative standard", "key":"TEST_PROJECT", "uuid":"{3b3e510b-7f2b-414d-a2b7-76c4e405c1c0}" }, "created_on":"2021-07-28T21:20:19.491721+00:00", "key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX5yfMOEw6HG9jKTYTisbmDTJ4MCUTSVGr5e4OWvY3UuI2A6F8SdzQqa2f5BABA/4g5Sk5awJrYHlNu3EzV1V2I44tR3A4fnZAG71ZKyDPi1wvdO7UYmFgxV/Vd18H9QZFFjICGDM7W0PT2mI0kON/jN3qNWi+GiB/xgaeQKSqynysdysDp8lnnI/8Sh3ikURP9UP83ShRCpAXszOUNaa+UUlcYQYBDLIGowsg51c4PCkC3DNhAMxppkNRKoSOWwyl+oRVXHSDylkiJSBHW3HH4Q6WHieD54kGrjbhWBKdnnxKX7QAAZBDseY+t01N36m6/ljvXSUEcBWtHxBYye0r", "type":"project_deploy_key", "id":1234 } ],} -
deployments.postRepositoriesWorkspaceRepoSlugDeployKeysCreate 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 -XPOST \-H "Authorization <auth header>" \-H "Content-type: application/json" \https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys -d \'{ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8", "label": "mydeploykey"}' Output:{ "id": 123, "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5", "label": "mydeploykey", "type": "deploy_key", "created_on": "2018-08-15T23:50:59.993890+00:00", "repository": { "full_name": "mleu/test", "name": "test", "type": "repository", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "links":{ "self":{ "href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/123" } } "last_used": null, "comment": "mleu@C02W454JHTD8"} -
deployments.postWorkspacesWorkspaceProjectsProjectKeyDeployKeysCreate a new deploy key in a project.
Example:
$ curl -XPOST \-H "Authorization <auth header>" \-H "Content-type: application/json" \https://api.bitbucket.org/2.0/workspaces/jzeng/projects/JZ/deploy-keys/ -d \'{ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8", "label": "mydeploykey"}' Output:{ "comment": "mleu@C02W454JHTD8", "last_used": null, "links": { "self": { "href": "https://api.bitbucket.org/2.0/workspaces/testadfsa/projects/ASDF/deploy-keys/5/" } }, "label": "myprojectkey", "project": { ... }, "created_on": "2021-08-10T05:28:00.570859+00:00", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5", "type": "project_deploy_key", "id": 5} -
deployments.putRepositoriesWorkspaceRepoSlugDeployKeysKeyIdCreate a new deploy key in a repository.
The same key needs to be passed in but the comment and label can change.
Example:
$ curl -XPUT \-H "Authorization <auth header>" \-H "Content-type: application/json" \https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/1234 -d \'{ "label": "newlabel", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 newcomment",}' Output:{ "comment": "newcomment", "last_used": null, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/1234" } }, "repository": { "full_name": "mleu/test", "name": "test", "type": "repository", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "label": "newlabel", "created_on": "2018-08-15T23:50:59.993890+00:00", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5", "id": 1234, "type": "deploy_key"} -
deployments.updateEnvironmentForRepositoryUpdate an environment
-
downloads.deleteRepositoriesWorkspaceRepoSlugDownloadsFilenameDeletes the specified download artifact from the repository.
-
downloads.getRepositoriesWorkspaceRepoSlugDownloadsReturns a list of download links associated with the repository.
-
downloads.getRepositoriesWorkspaceRepoSlugDownloadsFilenameReturn a redirect to the contents of a download artifact.
This endpoint returns the actual file contents and not the artifact's metadata.
-
downloads.postRepositoriesWorkspaceRepoSlugDownloadsUpload new download artifacts.
To upload files, perform a
multipart/form-dataPOST containing one or morefilesfields:When a file is uploaded with the same name as an existing artifact, then the existing file will be replaced.
-
issueTracker.deleteRepositoriesWorkspaceRepoSlugIssuesIssueIdDeletes the specified issue. This requires write access to the repository.
-
issueTracker.deleteRepositoriesWorkspaceRepoSlugIssuesIssueIdAttachmentsPathDeletes an attachment.
-
issueTracker.deleteRepositoriesWorkspaceRepoSlugIssuesIssueIdCommentsCommentIdDeletes the specified comment.
-
issueTracker.deleteRepositoriesWorkspaceRepoSlugIssuesIssueIdVoteRetract your vote.
-
issueTracker.deleteRepositoriesWorkspaceRepoSlugIssuesIssueIdWatchStop watching this issue.
-
issueTracker.getRepositoriesWorkspaceRepoSlugComponentsReturns the components that have been defined in the issue tracker.
This resource is only available on repositories that have the issue tracker enabled.
-
issueTracker.getRepositoriesWorkspaceRepoSlugComponentsComponentIdReturns the specified issue tracker component object.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesReturns the issues in the issue tracker.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesExportRepoNameIssuesTaskIdZipThis endpoint is used to poll for the progress of an issue export job and return the zip file after the job is complete. As long as the job is running, this will return a 200 response with in the response body a description of the current status.
After the job has been scheduled, but before it starts executing, this endpoint's response is:
{ "type": "issue_job_status", "status": "ACCEPTED", "phase": "Initializing", "total": 0, "count": 0, "pct": 0 }
Then once it starts running, it becomes:
{ "type": "issue_job_status", "status": "STARTED", "phase": "Attachments", "total": 15, "count": 11, "pct": 73 }
Once the job has successfully completed, it returns a stream of the zip file.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesImportWhen using GET, this endpoint reports the status of the current import task. Request example:
After the job has been scheduled, but before it starts executing, this endpoint's response is:
Once it starts running, it is a 202 response with status STARTED and progress filled.
After it is finished, it becomes a 200 response with status SUCCESS or FAILURE.
< HTTP/1.1 202 Accepted{ "type": "issue_job_status", "status": "PENDING", "phase": "Attachments", "total": 15, "count": 0, "percent": 0} -
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdReturns the specified issue.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdAttachmentsReturns all attachments for this issue.
This returns the files' meta data. This does not return the files' actual contents.
The files are always ordered by their upload date.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdAttachmentsPathReturns the contents of the specified file attachment.
Note that this endpoint does not return a JSON response, but instead returns a redirect pointing to the actual file that in turn will return the raw contents.
The redirect URL contains a one-time token that has a limited lifetime. As a result, the link should not be persisted, stored, or shared.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdChangesReturns the list of all changes that have been made to the specified issue. Changes are returned in chronological order with the oldest change first.
Each time an issue is edited in the UI or through the API, an immutable change record is created under the
/issues/123/changesendpoint. It also has a comment associated with the change.Note that this operation is changing significantly, due to privacy changes. See the for details.
Changes support that can be used to search for specific changes. For instance, to see when an issue transitioned to "resolved":
This resource is only available on repositories that have the issue tracker enabled.
N.B.
The
changes.assigneeandchanges.assignee_account_idfields are not auserobject. Instead, they contain the rawusernameandaccount_idof the user. This is to protect the integrity of the audit log even after a user account gets deleted.The
changes.assigneefield is deprecated will disappear in the future. Usechanges.assignee_account_idinstead.$ curl -s https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes - | jq . { "pagelen": 20, "values": [ { "changes": { "priority": { "new": "trivial", "old": "major" }, "assignee": { "new": "", "old": "evzijst" }, "assignee_account_id": { "new": "", "old": "557058:c0b72ad0-1cb5-4018-9cdc-0cde8492c443" }, "kind": { "new": "enhancement", "old": "bug" } }, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes/2" }, "html": { "href": "https://bitbucket.org/evzijst/dogslow/issues/1#comment-2" } }, "issue": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1" } }, "type": "issue", "id": 1, "repository": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/evzijst/dogslow" }, "html": { "href": "https://bitbucket.org/evzijst/dogslow" }, "avatar": { "href": "https://bitbucket.org/evzijst/dogslow/avatar/32/" } }, "type": "repository", "name": "dogslow", "full_name": "evzijst/dogslow", "uuid": "{988b17c6-1a47-4e70-84ee-854d5f012bf6}" }, "title": "Updated title" }, "created_on": "2018-03-03T00:35:28.353630+00:00", "user": { "username": "evzijst", "nickname": "evzijst", "display_name": "evzijst", "type": "user", "uuid": "{aaa7972b-38af-4fb1-802d-6e3854c95778}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/evzijst" }, "html": { "href": "https://bitbucket.org/evzijst/" }, "avatar": { "href": "https://bitbucket.org/account/evzijst/avatar/32/" } } }, "message": { "raw": "Removed assignee, changed kind and priority.", "markup": "markdown", "html": "<p>Removed assignee, changed kind and priority.</p>", "type": "rendered" }, "type": "issue_change", "id": 2 } ], "page": 1}$ curl -s https://api.bitbucket.org/2.0/repositories/site/master/issues/1/changes \ -G --data-urlencode='q=changes.state.new = "resolved"' -
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdChangesChangeIdReturns the specified issue change object.
This resource is only available on repositories that have the issue tracker enabled.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdCommentsReturns a paginated list of all comments that were made on the specified issue.
The default sorting is oldest to newest and can be overridden with the
sortquery parameter.This endpoint also supports filtering and sorting of the results. See for more details.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdCommentsCommentIdReturns the specified issue comment object.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdVoteCheck whether the authenticated user has voted for this issue. A 204 status code indicates that the user has voted, while a 404 implies they haven't.
-
issueTracker.getRepositoriesWorkspaceRepoSlugIssuesIssueIdWatchIndicated whether or not the authenticated user is watching this issue.
-
issueTracker.getRepositoriesWorkspaceRepoSlugMilestonesReturns the milestones that have been defined in the issue tracker.
This resource is only available on repositories that have the issue tracker enabled.
-
issueTracker.getRepositoriesWorkspaceRepoSlugMilestonesMilestoneIdReturns the specified issue tracker milestone object.
-
issueTracker.getRepositoriesWorkspaceRepoSlugVersionsReturns the versions that have been defined in the issue tracker.
This resource is only available on repositories that have the issue tracker enabled.
-
issueTracker.getRepositoriesWorkspaceRepoSlugVersionsVersionIdReturns the specified issue tracker version object.
-
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesCreates a new issue.
This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorization.
The authenticated user is used for the issue's
reporterfield. -
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesExportA POST request to this endpoint initiates a new background celery task that archives the repo's issues.
For example, you can run:
curl -u -X POST <owner_username>/<repo_slug>/ issues/export
When the job has been accepted, it will return a 202 (Accepted) along with a unique url to this job in the 'Location' response header. This url is the endpoint for where the user can obtain their zip files."
-
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesImportA POST request to this endpoint will import the zip file given by the archive parameter into the repository. All existing issues will be deleted and replaced by the contents of the imported zip file.
Imports are done through a multipart/form-data POST. There is one valid and required form field, with the name "archive," which needs to be a file field:
When the import job is accepted, here is example output:
< HTTP/1.1 202 Accepted { "type": "issue_job_status", "status": "ACCEPTED", "phase": "Attachments", "total": 15, "count": 0, "percent": 0} -
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesIssueIdAttachmentsUpload new issue attachments.
To upload files, perform a
multipart/form-dataPOST containing one or more file fields.When a file is uploaded with the same name as an existing attachment, then the existing file will be replaced.
-
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesIssueIdChangesMakes a change to the specified issue.
For example, to change an issue's state and assignee, create a new change object that modifies these fields:
The above example also includes a custom comment to go alongside the change. This comment will also be visible on the issue page in the UI.
The fields of the
changesobject are strings, not objects. This allows for immutable change log records, even after user accounts, milestones, or other objects recorded in a change entry, get renamed or deleted.The
assignee_account_idfield stores the account id. When POSTing a new change and changing the assignee, the client should therefore use the user's account_id in thechanges.assignee_account_id.newfield.This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorization.
curl https://api.bitbucket.org/2.0/site/master/issues/1234/changes \ -s -u evzijst -X POST -H "Content-Type: application/json" \ -d '{ "changes": { "assignee_account_id": { "new": "557058:c0b72ad0-1cb5-4018-9cdc-0cde8492c443" }, "state": { "new": 'resolved" } } "message": { "raw": "This is now resolved." } }' -
issueTracker.postRepositoriesWorkspaceRepoSlugIssuesIssueIdCommentsCreates a new issue comment.
-
issueTracker.putRepositoriesWorkspaceRepoSlugIssuesIssueIdModifies the issue.
This example changes the
title,assignee,priorityand theversion. It also removes the value of thecomponentfrom the issue by setting the field tonull. Any field not present keeps its existing value.Each time an issue is edited in the UI or through the API, an immutable change record is created under the
/issues/123/changesendpoint. It also has a comment associated with the change.$ curl https://api.bitbucket.org/2.0/repostories/evzijst/dogslow/issues/123 \ -u evzijst -s -X PUT -H 'Content-Type: application/json' \ -d '{ "title": "Updated title", "assignee": { "account_id": "5d5355e8c6b9320d9ea5b28d" }, "priority": "minor", "version": { "name": "1.0" }, "component": null}' -
issueTracker.putRepositoriesWorkspaceRepoSlugIssuesIssueIdCommentsCommentIdUpdates the content of the specified issue comment. Note that only the
content.rawfield can be modified. -
issueTracker.putRepositoriesWorkspaceRepoSlugIssuesIssueIdVoteVote for this issue.
To cast your vote, do an empty PUT. The 204 status code indicates that the operation was successful.
-
issueTracker.putRepositoriesWorkspaceRepoSlugIssuesIssueIdWatchStart watching this issue.
To start watching this issue, do an empty PUT. The 204 status code indicates that the operation was successful.
-
pipelines.createDeploymentVariableCreate a deployment environment level variable.
-
pipelines.createPipelineForRepositoryEndpoint to create and initiate a pipeline. There are a couple of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated.
Trigger a Pipeline for a branch
One way to trigger pipelines is by specifying the branch for which you want to trigger a pipeline. The specified branch will be used to determine which pipeline definition from the
bitbucket-pipelines.ymlfile will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified branch.Example
Trigger a Pipeline for a commit on a branch or tag
You can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark). The specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference.
The following reference types are supported:
branchnamed_branchbookmarktag
Example
Trigger a specific pipeline definition for a commit
You can trigger a specific pipeline that is defined in your
bitbucket-pipelines.ymlfile for a specific commit. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision.Example
Trigger a specific pipeline definition for a commit on a branch or tag
You can trigger a specific pipeline that is defined in your
bitbucket-pipelines.ymlfile for a specific commit in the context of a specified reference. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference.Example
Trigger a custom pipeline with variables
In addition to triggering a custom pipeline that is defined in your
bitbucket-pipelines.ymlfile as shown in the examples above, you can specify variables that will be available for your build. In the request, provide a list of variables, specifying the following for each variable: key, value, and whether it should be secured or not (this field is optional and defaults to not secured).Example
Trigger a pull request pipeline
You can also initiate a pipeline for a specific pull request.
Example
$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \ -d ' { "target": { "ref_type": "branch", "type": "pipeline_ref_target", "ref_name": "master" } }'$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \ -d ' { "target": { "commit": { "type": "commit", "hash": "ce5b7431602f7cbba007062eeb55225c6e18e956" }, "ref_type": "branch", "type": "pipeline_ref_target", "ref_name": "master" } }'$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \ -d ' { "target": { "commit": { "hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923", "type":"commit" }, "selector": { "type":"custom", "pattern":"Deploy to production" }, "type":"pipeline_commit_target" } }'$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \ -d ' { "target": { "commit": { "hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923", "type":"commit" }, "selector": { "type": "custom", "pattern": "Deploy to production" }, "type": "pipeline_ref_target", "ref_name": "master", "ref_type": "branch" } }'$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \ -d ' { "target": { "type": "pipeline_ref_target", "ref_type": "branch", "ref_name": "master", "selector": { "type": "custom", "pattern": "Deploy to production" } }, "variables": [ { "key": "var1key", "value": "var1value", "secured": true }, { "key": "var2key", "value": "var2value" } ] }'$ curl -X POST -is -u username:password \ -H 'Content-Type: application/json' \ https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \ -d ' { "target": { "type": "pipeline_pullrequest_target", "source": "pull-request-branch", "destination": "master", "destination_commit": { "hash" : "9f848b7" }, "commit": { "hash" : "1a372fc" }, "pullrequest" : { "id" : "3" }, "selector": { "type": "pull-requests", "pattern": "**" } } }' -
pipelines.createPipelineVariableForTeamCreate an account level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.createPipelineVariableForUserCreate a user level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.createPipelineVariableForWorkspaceCreate a workspace level variable.
-
pipelines.createRepositoryPipelineKnownHostCreate a repository level known host.
-
pipelines.createRepositoryPipelineScheduleCreate a schedule for the given repository.
-
pipelines.createRepositoryPipelineVariableCreate a repository level variable.
-
pipelines.deleteDeploymentVariableDelete a deployment environment level variable.
-
pipelines.deletePipelineVariableForTeamDelete a team level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.deletePipelineVariableForUserDelete an account level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.deletePipelineVariableForWorkspaceDelete a workspace level variable.
-
pipelines.deleteRepositoryPipelineCacheDelete a repository cache.
-
pipelines.deleteRepositoryPipelineCachesDelete repository cache versions by name.
-
pipelines.deleteRepositoryPipelineKeyPairDelete the repository SSH key pair.
-
pipelines.deleteRepositoryPipelineKnownHostDelete a repository level known host.
-
pipelines.deleteRepositoryPipelineScheduleDelete a schedule.
-
pipelines.deleteRepositoryPipelineVariableDelete a repository level variable.
-
pipelines.getDeploymentVariablesFind deployment environment level variables.
-
pipelines.getOidcConfigurationThis is part of OpenID Connect for Pipelines, see
-
pipelines.getOidcKeysThis is part of OpenID Connect for Pipelines, see
-
pipelines.getPipelineContainerLogRetrieve the log file for a build container or service container.
This endpoint supports (and encourages!) the use of to deal with potentially very large log files.
-
pipelines.getPipelineForRepositoryRetrieve a specified pipeline
-
pipelines.getPipelinesForRepositoryFind pipelines
-
pipelines.getPipelineStepForRepositoryRetrieve a given step of a pipeline.
-
pipelines.getPipelineStepLogForRepositoryRetrieve the log file for a given step of a pipeline.
This endpoint supports (and encourages!) the use of to deal with potentially very large log files.
-
pipelines.getPipelineStepsForRepositoryFind steps for the given pipeline.
-
pipelines.getPipelineTestReportsGet a summary of test reports for a given step of a pipeline.
-
pipelines.getPipelineTestReportTestCaseReasonsGet test case reasons (output) for a given test case in a step of a pipeline.
-
pipelines.getPipelineTestReportTestCasesGet test cases for a given step of a pipeline.
-
pipelines.getPipelineVariableForTeamRetrieve a team level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.getPipelineVariableForUserRetrieve a user level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.getPipelineVariableForWorkspaceRetrieve a workspace level variable.
-
pipelines.getPipelineVariablesForTeamFind account level variables. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.getPipelineVariablesForUserFind user level variables. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.getPipelineVariablesForWorkspaceFind workspace level variables.
-
pipelines.getRepositoryPipelineCacheContentUriRetrieve the URI of the content of the specified cache.
-
pipelines.getRepositoryPipelineCachesRetrieve the repository pipelines caches.
-
pipelines.getRepositoryPipelineConfigRetrieve the repository pipelines configuration.
-
pipelines.getRepositoryPipelineKnownHostRetrieve a repository level known host.
-
pipelines.getRepositoryPipelineKnownHostsFind repository level known hosts.
-
pipelines.getRepositoryPipelineScheduleRetrieve a schedule by its UUID.
-
pipelines.getRepositoryPipelineScheduleExecutionsRetrieve the executions of a given schedule.
-
pipelines.getRepositoryPipelineSchedulesRetrieve the configured schedules for the given repository.
-
pipelines.getRepositoryPipelineSshKeyPairRetrieve the repository SSH key pair excluding the SSH private key. The private key is a write only field and will never be exposed in the logs or the REST API.
-
pipelines.getRepositoryPipelineVariableRetrieve a repository level variable.
-
pipelines.getRepositoryPipelineVariablesFind repository level variables.
-
pipelines.stopPipelineSignal the stop of a pipeline and all of its steps that not have completed yet.
-
pipelines.updateDeploymentVariableUpdate a deployment environment level variable.
-
pipelines.updatePipelineVariableForTeamUpdate a team level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.updatePipelineVariableForUserUpdate a user level variable. This endpoint has been deprecated, and you should use the new workspaces endpoint. For more information, see .
-
pipelines.updatePipelineVariableForWorkspaceUpdate a workspace level variable.
-
pipelines.updateRepositoryBuildNumberUpdate the next build number that should be assigned to a pipeline. The next build number that will be configured has to be strictly higher than the current latest build number for this repository.
-
pipelines.updateRepositoryPipelineConfigUpdate the pipelines configuration for a repository.
-
pipelines.updateRepositoryPipelineKeyPairCreate or update the repository SSH key pair. The private key will be set as a default SSH identity in your build container.
-
pipelines.updateRepositoryPipelineKnownHostUpdate a repository level known host.
-
pipelines.updateRepositoryPipelineScheduleUpdate a schedule.
-
pipelines.updateRepositoryPipelineVariableUpdate a repository level variable.
-
projects.deleteWorkspacesWorkspaceProjectsProjectKeyDeletes this project. This is an irreversible operation.
You cannot delete a project that still contains repositories. To delete the project, or transfer the repositories first.
Example:
-
projects.deleteWorkspacesWorkspaceProjectsProjectKeyDefaultReviewersSelectedUserRemoves a default reviewer from the project.
Example:
-
projects.getWorkspacesWorkspaceProjectsProjectKeyReturns the requested project.
-
projects.getWorkspacesWorkspaceProjectsProjectKeyDefaultReviewersReturn a list of all default reviewers for a project. This is a list of users that will be added as default reviewers to pull requests for any repository within the project.
Example:
$ curl https://api.bitbucket.org/2.0/.../projects/.../default-reviewers | jq .{ "pagelen": 10, "values": [ { "user": { "display_name": "Davis Lee", "uuid": "{f0e0e8e9-66c1-4b85-a784-44a9eb9ef1a6}" }, "reviewer_type": "project", "type": "default_reviewer" }, { "user": { "display_name": "Jorge Rodriguez", "uuid": "{1aa43376-260d-4a0b-9660-f62672b9655d}" }, "reviewer_type": "project", "type": "default_reviewer" } ], "page": 1, "size": 2} -
projects.getWorkspacesWorkspaceProjectsProjectKeyDefaultReviewersSelectedUserReturns the specified default reviewer.
Example:
-
projects.postWorkspacesWorkspaceProjectsCreates a new project.
Note that the avatar has to be embedded as either a data-url or a URL to an external image as shown in the examples below:
or even:
$ body=$(cat << EOF{ "name": "Mars Project", "key": "MARS", "description": "Software for colonizing mars.", "links": { "avatar": { "href": "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/..." } }, "is_private": false}EOF)$ curl -H "Content-Type: application/json" \ -X POST \ -d "$body" \ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq .{ // Serialized project document}$ body=$(cat << EOF{ "name": "Mars Project", "key": "MARS", "description": "Software for colonizing mars.", "links": { "avatar": { "href": "http://i.imgur.com/72tRx4w.gif" } }, "is_private": false}EOF)$ curl -H "Content-Type: application/json" \ -X POST \ -d "$body" \ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq .{ // Serialized project document} -
projects.putWorkspacesWorkspaceProjectsProjectKeySince this endpoint can be used to both update and to create a project, the request body depends on the intent.
Creation
See the POST documentation for the project collection for an example of the request body.
Note: The
keyshould not be specified in the body of request (since it is already present in the URL). Thenameis required, everything else is optional.Update
See the POST documentation for the project collection for an example of the request body.
Note: The key is not required in the body (since it is already in the URL). The key may be specified in the body, if the intent is to change the key itself. In such a scenario, the location of the project is changed and is returned in the
Locationheader of the response. -
projects.putWorkspacesWorkspaceProjectsProjectKeyDefaultReviewersSelectedUserAdds the specified user to the project's list of default reviewers. The method is idempotent. Accepts an optional body containing the
uuidof the user to be added.Example:
-
properties.deleteCommitHostedPropertyValueDelete an value stored against a commit.
-
properties.deletePullRequestHostedPropertyValueDelete an value stored against a pull request.
-
properties.deleteRepositoryHostedPropertyValueDelete an value stored against a repository.
-
properties.deleteUserHostedPropertyValueDelete an value stored against a user.
-
properties.getCommitHostedPropertyValueRetrieve an value stored against a commit.
-
properties.getPullRequestHostedPropertyValueRetrieve an value stored against a pull request.
-
properties.getRepositoryHostedPropertyValueRetrieve an value stored against a repository.
-
properties.retrieveUserHostedPropertyValueRetrieve an value stored against a user.
-
properties.updateCommitHostedPropertyValueUpdate an value stored against a commit.
-
properties.updatePullRequestHostedPropertyValueUpdate an value stored against a pull request.
-
properties.updateRepositoryHostedPropertyValueUpdate an value stored against a repository.
-
properties.updateUserHostedPropertyValueUpdate an value stored against a user.
-
pullrequests.deleteRepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernameRemoves a default reviewer from the repository.
-
pullrequests.deleteRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdApproveRedact the authenticated user's approval of the specified pull request.
-
pullrequests.deleteRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCommentIdDeletes a specific pull request comment.
-
pullrequests.deleteRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdRequestChanges -
pullrequests.getPullrequestsForCommitReturns a paginated list of all pull requests as part of which this commit was reviewed. Pull Request Commit Links app must be installed first before using this API; installation automatically occurs when 'Go to pull request' is clicked from the web interface for a commit's details.
-
pullrequests.getPullrequestsSelectedUserReturns all pull requests authored by the specified user.
By default only open pull requests are returned. This can be controlled using the
statequery parameter. To retrieve pull requests that are in one of multiple states, repeat thestateparameter for each individual state.This endpoint also supports filtering and sorting of the results. See for more details.
-
pullrequests.getRepositoriesWorkspaceRepoSlugDefaultReviewersReturns the repository's default reviewers.
These are the users that are automatically added as reviewers on every new pull request that is created. To obtain the repository's default reviewers as well as the default reviewers inherited from the project, use the endpoint.
-
pullrequests.getRepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernameReturns the specified reviewer.
This can be used to test whether a user is among the repository's default reviewers list. A 404 indicates that that specified user is not a default reviewer.
-
pullrequests.getRepositoriesWorkspaceRepoSlugEffectiveDefaultReviewersReturns the repository's effective default reviewers. This includes both default reviewers defined at the repository level as well as those inherited from its project.
These are the users that are automatically added as reviewers on every new pull request that is created.
$ curl https://api.bitbucket.org/2.0/repositories/{workspace_slug}/{repo_slug}/effective-default-reviewers?page=1&pagelen=20{ "pagelen": 20, "values": [ { "user": { "display_name": "Patrick Wolf", "uuid": "{9565301a-a3cf-4b5d-88f4-dd6af8078d7e}" }, "reviewer_type": "project", "type": "default_reviewer", }, { "user": { "display_name": "Davis Lee", "uuid": "{f0e0e8e9-66c1-4b85-a784-44a9eb9ef1a6}" }, "reviewer_type": "repository", "type": "default_reviewer", } ], "page": 1, "size": 2} -
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsReturns all pull requests on the specified repository.
By default only open pull requests are returned. This can be controlled using the
statequery parameter. To retrieve pull requests that are in one of multiple states, repeat thestateparameter for each individual state.This endpoint also supports filtering and sorting of the results. See for more details.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsActivityReturns a paginated list of the pull request's activity log.
This handler serves both a v20 and internal endpoint. The v20 endpoint returns reviewer comments, updates, approvals and request changes. The internal endpoint includes those plus tasks and attachments.
Comments created on a file or a line of code have an inline property.
Comment example:
Updates include a state property of OPEN, MERGED, or DECLINED.
Update example:
Approval example:
{ "pagelen": 20, "values": [ { "comment": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695/comments/118571088" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695/_/diff#comment-118571088" } }, "deleted": false, "pullrequest": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" }, "content": { "raw": "inline with to a dn from lines", "markup": "markdown", "html": "<p>inline with to a dn from lines</p>", "type": "rendered" }, "created_on": "2019-09-27T00:33:46.039178+00:00", "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "created_on": "2019-09-27T00:33:46.039178+00:00", "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "updated_on": "2019-09-27T00:33:46.055384+00:00", "inline": { "context_lines": "", "to": null, "path": "", "outdated": false, "from": 211 }, "type": "pullrequest_comment", "id": 118571088 }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]}{ "pagelen": 20, "values": [ { "update": { "description": "", "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it", "destination": { "commit": { "type": "commit", "hash": "6a2c16e4a152", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/6a2c16e4a152" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6a2c16e4a152" } } }, "branch": { "name": "master" }, "repository": { "name": "Atlaskit-MK-2", "type": "repository", "full_name": "atlassian/atlaskit-mk-2", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js" } }, "uuid": "{}" } }, "reason": "", "source": { "commit": { "type": "commit", "hash": "728c8bad1813", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/728c8bad1813" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/728c8bad1813" } } }, "branch": { "name": "username/NONE-add-onClick-prop-for-accessibility" }, "repository": { "name": "Atlaskit-MK-2", "type": "repository", "full_name": "atlassian/atlaskit-mk-2", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js" } }, "uuid": "{}" } }, "state": "OPEN", "author": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "date": "2019-05-10T06:48:25.305565+00:00" }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]}{ "pagelen": 20, "values": [ { "approval": { "date": "2019-09-27T00:37:19.849534+00:00", "pullrequest": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" }, "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" } }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]} -
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdReturns the specified pull request.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdActivityReturns a paginated list of the pull request's activity log.
This handler serves both a v20 and internal endpoint. The v20 endpoint returns reviewer comments, updates, approvals and request changes. The internal endpoint includes those plus tasks and attachments.
Comments created on a file or a line of code have an inline property.
Comment example:
Updates include a state property of OPEN, MERGED, or DECLINED.
Update example:
Approval example:
{ "pagelen": 20, "values": [ { "comment": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695/comments/118571088" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695/_/diff#comment-118571088" } }, "deleted": false, "pullrequest": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" }, "content": { "raw": "inline with to a dn from lines", "markup": "markdown", "html": "<p>inline with to a dn from lines</p>", "type": "rendered" }, "created_on": "2019-09-27T00:33:46.039178+00:00", "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "created_on": "2019-09-27T00:33:46.039178+00:00", "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "updated_on": "2019-09-27T00:33:46.055384+00:00", "inline": { "context_lines": "", "to": null, "path": "", "outdated": false, "from": 211 }, "type": "pullrequest_comment", "id": 118571088 }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]}{ "pagelen": 20, "values": [ { "update": { "description": "", "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it", "destination": { "commit": { "type": "commit", "hash": "6a2c16e4a152", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/6a2c16e4a152" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6a2c16e4a152" } } }, "branch": { "name": "master" }, "repository": { "name": "Atlaskit-MK-2", "type": "repository", "full_name": "atlassian/atlaskit-mk-2", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js" } }, "uuid": "{}" } }, "reason": "", "source": { "commit": { "type": "commit", "hash": "728c8bad1813", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/728c8bad1813" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/728c8bad1813" } } }, "branch": { "name": "username/NONE-add-onClick-prop-for-accessibility" }, "repository": { "name": "Atlaskit-MK-2", "type": "repository", "full_name": "atlassian/atlaskit-mk-2", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js" } }, "uuid": "{}" } }, "state": "OPEN", "author": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" }, "date": "2019-05-10T06:48:25.305565+00:00" }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]}{ "pagelen": 20, "values": [ { "approval": { "date": "2019-09-27T00:37:19.849534+00:00", "pullrequest": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" }, "user": { "display_name": "Name Lastname", "uuid": "{}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B%7D" }, "html": { "href": "https://bitbucket.org/%7B%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128" } }, "type": "user", "nickname": "Name", "account_id": "" } }, "pull_request": { "type": "pullrequest", "id": 5695, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695" }, "html": { "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695" } }, "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it" } } ]} -
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsReturns a paginated list of the pull request's comments.
This includes both global, inline comments and replies.
The default sorting is oldest to newest and can be overridden with the
sortquery parameter.This endpoint also supports filtering and sorting of the results. See for more details.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCommentIdReturns a specific pull request comment.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommitsReturns a paginated list of the pull request's commits.
These are the commits that are being merged into the destination branch when the pull requests gets accepted.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdDiffRedirects to the with the revspec that corresponds to the pull request.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdDiffstatRedirects to the with the revspec that corresponds to the pull request.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdMergeTaskStatusTaskIdWhen merging a pull request takes too long, the client receives a task ID along with a 202 status code. The task ID can be used in a call to this endpoint to check the status of a merge task.
If the merge task is not yet finished, a PENDING status will be returned.
If the merge was successful, a SUCCESS status will be returned.
If the merge task failed, an error will be returned.
curl -X GET https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>HTTP/2 200{ "task_status": "PENDING", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>" } }}HTTP/2 200{ "task_status": "SUCCESS", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>" } }, "merge_result": <the merged pull request object>}{ "type": "error", "error": { "message": "<error message>" }} -
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdPatchRedirects to the with the revspec that corresponds to pull request.
-
pullrequests.getRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdStatusesReturns all statuses (e.g. build results) for the given pull request.
-
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsCreates a new pull request where the destination repository is this repository and the author is the authenticated user.
The minimum required fields to create a pull request are
titleandsource, specified by a branch name.If the pull request's
destinationis not specified, it will default to therepository.mainbranch. To open a pull request to a different branch, say from a feature branch to a staging branch, specify adestination(same format as thesource):Reviewers can be specified by adding an array of user objects as the
reviewersproperty.Other fields:
description- a stringclose_source_branch- boolean that specifies if the source branch should be closed upon merging
curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repository/pullrequests \ -u my-username:my-password \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "title": "My Title", "source": { "branch": { "name": "staging" } } }'{ "title": "My Title", "source": { "branch": { "name": "my-feature-branch" } }, "destination": { "branch": { "name": "staging" } }}{ "title": "My Title", "source": { "branch": { "name": "my-feature-branch" } }, "reviewers": [ { "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" } ]} -
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdApproveApprove the specified pull request as the authenticated user.
-
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCreates a new pull request comment.
Returns the newly created pull request comment.
-
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdDeclineDeclines the pull request.
-
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdMergeMerges the pull request.
-
pullrequests.postRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdRequestChanges -
pullrequests.putRepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernameAdds the specified user to the repository's list of default reviewers.
This method is idempotent. Adding a user a second time has no effect.
-
pullrequests.putRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdMutates the specified pull request.
This can be used to change the pull request's branches or description.
Only open pull requests can be mutated.
-
pullrequests.putRepositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCommentIdUpdates a specific pull request comment.
-
refs.deleteRepositoriesWorkspaceRepoSlugRefsBranchesNameDelete a branch in the specified repository.
The main branch is not allowed to be deleted and will return a 400 response.
The branch name should not include any prefixes (e.g. refs/heads).
-
refs.deleteRepositoriesWorkspaceRepoSlugRefsTagsNameDelete a tag in the specified repository.
The tag name should not include any prefixes (e.g. refs/tags).
-
refs.getRepositoriesWorkspaceRepoSlugRefsReturns the branches and tags in the repository.
By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git show-ref". Note that this follows simple lexical ordering of the ref names.
This can be undesirable as it does apply any natural sorting semantics, meaning for instance that refs are sorted ["branch1", "branch10", "branch2", "v10", "v11", "v9"] instead of ["branch1", "branch2", "branch10", "v9", "v10", "v11"].
Sorting can be changed using the ?sort= query parameter. When using ?sort=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings.
-
refs.getRepositoriesWorkspaceRepoSlugRefsBranchesReturns a list of all open branches within the specified repository. Results will be in the order the source control manager returns them.
", "type": "commit" } } ], "page": 1, "next": "" } ```
``` $ curl -s https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches?pagelen=1 | jq . { "pagelen": 1, "size": 187, "values": [ { "name": "issue-9.3/AUI-5343-assistive-class", "links": { "commits": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commits/issue-9.3/AUI-5343-assistive-class" }, "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches/issue-9.3/AUI-5343-assistive-class" }, "html": { "href": "https://bitbucket.org/atlassian/aui/branch/issue-9.3/AUI-5343-assistive-class" } }, "default_merge_strategy": "squash", "merge_strategies": [ "merge_commit", "squash", "fast_forward" ], "type": "branch", "target": { "hash": "e5d1cde9069fcb9f0af90403a4de2150c125a148", "repository": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui" }, "html": { "href": "https://bitbucket.org/atlassian/aui" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B585074de-7b60-4fd1-81ed-e0bc7fafbda5%7D?ts=86317" } }, "type": "repository", "name": "aui", "full_name": "atlassian/aui", "uuid": "{585074de-7b60-4fd1-81ed-e0bc7fafbda5}" }, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e5d1cde9069fcb9f0af90403a4de2150c125a148" }, "comments": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e5d1cde9069fcb9f0af90403a4de2150c125a148/comments" }, "patch": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/patch/e5d1cde9069fcb9f0af90403a4de2150c125a148" }, "html": { "href": "https://bitbucket.org/atlassian/aui/commits/e5d1cde9069fcb9f0af90403a4de2150c125a148" }, "diff": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/diff/e5d1cde9069fcb9f0af90403a4de2150c125a148" }, "approve": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e5d1cde9069fcb9f0af90403a4de2150c125a148/approve" }, "statuses": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e5d1cde9069fcb9f0af90403a4de2150c125a148/statuses" } }, "author": { "raw": "Marcin Konopka <mkonopka@atlassian.com>", "type": "author", "user": { "display_name": "Marcin Konopka", "uuid": "{47cc24f4-2a05-4420-88fe-0417535a110a}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B47cc24f4-2a05-4420-88fe-0417535a110a%7D" }, "html": { "href": "https://bitbucket.org/%7B47cc24f4-2a05-4420-88fe-0417535a110a%7D/" }, "avatar": { "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/MK-1.png" } }, "nickname": "Marcin Konopka", "type": "user", "account_id": "60113d2b47a9540069f4de03" } }, "parents": [ { "hash": "87f7fc92b00464ae47b13ef65c91884e4ac9be51", "type": "commit", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/87f7fc92b00464ae47b13ef65c91884e4ac9be51" }, "html": { "href": "https://bitbucket.org/atlassian/aui/commits/87f7fc92b00464ae47b13ef65c91884e4ac9be51" } } } ], "date": "2021-04-13T13:44:49+00:00", "message": "wipBranches support [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) that can be used to search for specific branches. For instance, to find all branches that have "stab" in their name: ``` curl -s https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches -G --data-urlencode 'q=name ~ "stab"' ``` By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git branch --list". Note that this follows simple lexical ordering of the ref names. This can be undesirable as it does apply any natural sorting semantics, meaning for instance that tags are sorted ["v10", "v11", "v9"] instead of ["v9", "v10", "v11"]. Sorting can be changed using the ?q= query parameter. When using ?q=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings. -
refs.getRepositoriesWorkspaceRepoSlugRefsBranchesNameReturns a branch object within the specified repository.
chore(deps): update babel monorepo to v7.13.15 (master)
Approved-by: Chris "Daz" Darroch ", "type": "commit" } } ```
``` $ curl -s https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches/master | jq . { "name": "master", "links": { "commits": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commits/master" }, "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches/master" }, "html": { "href": "https://bitbucket.org/atlassian/aui/branch/master" } }, "default_merge_strategy": "squash", "merge_strategies": [ "merge_commit", "squash", "fast_forward" ], "type": "branch", "target": { "hash": "e7d158ff7ed5538c28f94cd97a9ad569680fc94e", "repository": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui" }, "html": { "href": "https://bitbucket.org/atlassian/aui" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B585074de-7b60-4fd1-81ed-e0bc7fafbda5%7D?ts=86317" } }, "type": "repository", "name": "aui", "full_name": "atlassian/aui", "uuid": "{585074de-7b60-4fd1-81ed-e0bc7fafbda5}" }, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e7d158ff7ed5538c28f94cd97a9ad569680fc94e" }, "comments": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e7d158ff7ed5538c28f94cd97a9ad569680fc94e/comments" }, "patch": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/patch/e7d158ff7ed5538c28f94cd97a9ad569680fc94e" }, "html": { "href": "https://bitbucket.org/atlassian/aui/commits/e7d158ff7ed5538c28f94cd97a9ad569680fc94e" }, "diff": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/diff/e7d158ff7ed5538c28f94cd97a9ad569680fc94e" }, "approve": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e7d158ff7ed5538c28f94cd97a9ad569680fc94e/approve" }, "statuses": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/e7d158ff7ed5538c28f94cd97a9ad569680fc94e/statuses" } }, "author": { "raw": "psre-renovate-bot <psre-renovate-bot@atlassian.com>", "type": "author", "user": { "display_name": "psre-renovate-bot", "uuid": "{250a442a-3ab3-4fcb-87c3-3c8f3df65ec7}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/%7B250a442a-3ab3-4fcb-87c3-3c8f3df65ec7%7D" }, "html": { "href": "https://bitbucket.org/%7B250a442a-3ab3-4fcb-87c3-3c8f3df65ec7%7D/" }, "avatar": { "href": "https://secure.gravatar.com/avatar/6972ee037c9f36360170a86f544071a2?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FP-3.png" } }, "nickname": "Renovate Bot", "type": "user", "account_id": "5d5355e8c6b9320d9ea5b28d" } }, "parents": [ { "hash": "eab868a309e75733de80969a7bed1ec6d4651e06", "type": "commit", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/aui/commit/eab868a309e75733de80969a7bed1ec6d4651e06" }, "html": { "href": "https://bitbucket.org/atlassian/aui/commits/eab868a309e75733de80969a7bed1ec6d4651e06" } } } ], "date": "2021-04-12T06:44:38+00:00", "message": "Merged in issue/NONE-renovate-master-babel-monorepo (pull request #2883)This call requires authentication. Private repositories require the caller to authenticate with an account that has appropriate authorization. For Git, the branch name should not include any prefixes (e.g. refs/heads). -
refs.getRepositoriesWorkspaceRepoSlugRefsTagsReturns the tags in the repository.
By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git tag --list". Note that this follows simple lexical ordering of the ref names.
This can be undesirable as it does apply any natural sorting semantics, meaning for instance that tags are sorted ["v10", "v11", "v9"] instead of ["v9", "v10", "v11"].
Sorting can be changed using the ?sort= query parameter. When using ?sort=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings.
-
refs.getRepositoriesWorkspaceRepoSlugRefsTagsNameReturns the specified tag.
$ curl -s https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/tags/3.8 -G | jq .{ "name": "3.8", "links": { "commits": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commits/3.8" }, "self": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/tags/3.8" }, "html": { "href": "https://bitbucket.org/seanfarley/hg/commits/tag/3.8" } }, "tagger": { "raw": "Matt Mackall <mpm@selenic.com>", "type": "author", "user": { "username": "mpmselenic", "nickname": "mpmselenic", "display_name": "Matt Mackall", "type": "user", "uuid": "{a4934530-db4c-419c-a478-9ab4964c2ee7}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/mpmselenic" }, "html": { "href": "https://bitbucket.org/mpmselenic/" }, "avatar": { "href": "https://bitbucket.org/account/mpmselenic/avatar/32/" } } } }, "date": "2016-05-01T18:52:25+00:00", "message": "Added tag 3.8 for changeset f85de28eae32", "type": "tag", "target": { "hash": "f85de28eae32e7d3064b1a1321309071bbaaa069", "repository": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg" }, "html": { "href": "https://bitbucket.org/seanfarley/hg" }, "avatar": { "href": "https://bitbucket.org/seanfarley/hg/avatar/32/" } }, "type": "repository", "name": "hg", "full_name": "seanfarley/hg", "uuid": "{c75687fb-e99d-4579-9087-190dbd406d30}" }, "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069" }, "comments": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/comments" }, "patch": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/patch/f85de28eae32e7d3064b1a1321309071bbaaa069" }, "html": { "href": "https://bitbucket.org/seanfarley/hg/commits/f85de28eae32e7d3064b1a1321309071bbaaa069" }, "diff": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/diff/f85de28eae32e7d3064b1a1321309071bbaaa069" }, "approve": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/approve" }, "statuses": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/statuses" } }, "author": { "raw": "Sean Farley <sean@farley.io>", "type": "author", "user": { "username": "seanfarley", "nickname": "seanfarley", "display_name": "Sean Farley", "type": "user", "uuid": "{a295f8a8-5876-4d43-89b5-3ad8c6c3c51d}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/seanfarley" }, "html": { "href": "https://bitbucket.org/seanfarley/" }, "avatar": { "href": "https://bitbucket.org/account/seanfarley/avatar/32/" } } } }, "parents": [ { "hash": "9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2", "type": "commit", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2" }, "html": { "href": "https://bitbucket.org/seanfarley/hg/commits/9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2" } } } ], "date": "2016-05-01T04:21:17+00:00", "message": "debian: alphabetize build deps", "type": "commit" }} -
refs.postRepositoriesWorkspaceRepoSlugRefsBranchesCreates a new branch in the specified repository.
The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash.
This call requires authentication. Private repositories require the caller to authenticate with an account that has appropriate authorization.
The branch name should not include any prefixes (e.g. refs/heads). This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach.
-
refs.postRepositoriesWorkspaceRepoSlugRefsTagsCreates a new tag in the specified repository.
The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash.
This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach.
-
reports.bulkCreateOrUpdateAnnotationsBulk upload of annotations. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations.
Add the annotations you want to upload as objects in a JSON array and make sure each annotation has the external_id field set to a unique value. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001. The external id can later be used to identify the report as an alternative to the generated . You can upload up to 100 annotations per POST request.
Sample cURL request:
Possible field values:
annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL
Please refer to the for more information.
curl --location 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001/annotations' \--header 'Content-Type: application/json' \--data-raw '[ { "external_id": "mysystem-annotation001", "title": "Security scan report", "annotation_type": "VULNERABILITY", "summary": "This line represents a security threat.", "severity": "HIGH", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Main.java", "line": 42 }, { "external_id": "mySystem-annotation002", "title": "Bug report", "annotation_type": "BUG", "result": "FAILED", "summary": "This line might introduce a bug.", "severity": "MEDIUM", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Helper.java", "line": 13 }]' -
reports.createOrUpdateAnnotationCreates or updates an individual annotation for the specified report. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations.
Just as reports, annotation needs to be uploaded with a unique ID that can later be used to identify the report as an alternative to the generated . If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001.
Sample cURL request:
Possible field values:
annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL
Please refer to the for more information.
curl --request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mySystem-001/annotations/mysystem-annotation001' \--header 'Content-Type: application/json' \--data-raw '{ "title": "Security scan report", "annotation_type": "VULNERABILITY", "summary": "This line represents a security thread.", "severity": "HIGH", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Main.java", "line": 42}' -
reports.createOrUpdateReportCreates or updates a report for the specified commit. To upload a report, make sure to generate an ID that is unique across all reports for that commit. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-001.
Sample cURL request:
Possible field values:
report_type: SECURITY, COVERAGE, TEST, BUG result: PASSED, FAILED, PENDING data.type: BOOLEAN, DATE, DURATION, LINK, NUMBER, PERCENTAGE, TEXT
Data field formats
Please refer to the for more information.
curl --request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001' \--header 'Content-Type: application/json' \--data-raw '{ "title": "Security scan report", "details": "This pull request introduces 10 new dependency vulnerabilities.", "report_type": "SECURITY", "reporter": "mySystem", "link": "http://www.mysystem.com/reports/001", "result": "FAILED", "data": [ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } ]}' -
reports.deleteAnnotationDeletes a single Annotation matching the provided ID.
-
reports.deleteReportDeletes a single Report matching the provided ID.
-
reports.getAnnotationReturns a single Annotation matching the provided ID.
-
reports.getAnnotationsForReportReturns a paginated list of Annotations for a specified report.
-
reports.getReportReturns a single Report matching the provided ID.
-
reports.getReportsForCommitReturns a paginated list of Reports linked to this commit.
-
repositories.deleteRepositoriesWorkspaceRepoSlugDeletes the repository. This is an irreversible operation.
This does not affect its forks.
-
repositories.deleteRepositoriesWorkspaceRepoSlugHooksUidDeletes the specified webhook subscription from the given repository.
-
repositories.deleteRepositoriesWorkspaceRepoSlugPermissionsConfigGroupsGroupSlugDeletes the repository group permission between the requested repository and group, if one exists.
Only users with admin permission for the repository may access this resource.
Example:
$ curl -X DELETE /geordi/permissions-config/groups/developers
HTTP/1.1 204
-
repositories.deleteRepositoriesWorkspaceRepoSlugPermissionsConfigUsersSelectedUserIdDeletes the repository user permission between the requested repository and user, if one exists.
Only users with admin permission for the repository may access this resource.
The only authentication method for this endpoint is via app passwords.
-
repositories.getRepositoriesReturns a paginated list of all public repositories.
This endpoint also supports filtering and sorting of the results. See for more details.
-
repositories.getRepositoriesWorkspaceReturns a paginated list of all repositories owned by the specified workspace.
The result can be narrowed down based on the authenticated user's role.
E.g. with
?role=contributor, only those repositories that the authenticated user has write access to are returned (this includes any repo the user is an admin on, as that implies write access).This endpoint also supports filtering and sorting of the results. See for more details.
-
repositories.getRepositoriesWorkspaceRepoSlugReturns the object describing this repository.
-
repositories.getRepositoriesWorkspaceRepoSlugForksReturns a paginated list of all the forks of the specified repository.
-
repositories.getRepositoriesWorkspaceRepoSlugHooksReturns a paginated list of webhooks installed on this repository.
-
repositories.getRepositoriesWorkspaceRepoSlugHooksUidReturns the webhook with the specified id installed on the specified repository.
-
repositories.getRepositoriesWorkspaceRepoSlugOverrideSettings -
repositories.getRepositoriesWorkspaceRepoSlugPermissionsConfigGroupsReturns a paginated list of explicit group permissions for the given repository. This endpoint does not support BBQL features.
Example:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups HTTP/1.1 200Location: https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups { "pagelen": 10, "values": [ { "type": "repository_group_permission", "group": { "type": "group", "name": "Administrators", "slug": "administrators" }, "permission": "admin", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/ geordi/permissions-config/groups/administrators" } } }, { "type": "repository_group_permission", "group": { "type": "group", "name": "Developers", "slug": "developers" }, "permission": "read", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/ geordi/permissions-config/groups/developers" } } } ], "page": 1, "size": 2} -
repositories.getRepositoriesWorkspaceRepoSlugPermissionsConfigGroupsGroupSlugReturns the group permission for a given group slug and repository
Only users with admin permission for the repository may access this resource.
Permissions can be:
adminwritereadnone
Example:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers HTTP/1.1 200Location:https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers { "type": "repository_group_permission", "group": { "type": "group", "name": "Developers", "slug": "developers" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "read", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers" } }} -
repositories.getRepositoriesWorkspaceRepoSlugPermissionsConfigUsersReturns a paginated list of explicit user permissions for the given repository. This endpoint does not support BBQL features.
Example:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/users { "pagelen": 10, "values": [ { "type": "repository_user_permission", "user": { "type": "user", "display_name": "Colin Cameron", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}", "account_id": "557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" }, "permission": "admin", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" } } }, { "type": "repository_user_permission", "user": { "type": "user", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}", "account_id": "557058:ba8948b2-49da-43a9-9e8b-e7249b8e324c" }, "permission": "write", "links": { "self": { "href": "https://api.bitbucket.org/2.0//repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324c" } } } ], "page": 1, "size": 2} -
repositories.getRepositoriesWorkspaceRepoSlugPermissionsConfigUsersSelectedUserIdReturns the explicit user permission for a given user and repository.
Only users with admin permission for the repository may access this resource.
Permissions can be:
adminwritereadnone
Example:
$ curl 'https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a' HTTP/1.1 200Location: 'https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a' { "type": "repository_user_permission", "user": { "type": "user", "display_name": "Colin Cameron", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}", "account_id": "557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" } }} -
repositories.getRepositoriesWorkspaceRepoSlugWatchersReturns a paginated list of all the watchers on the specified repository.
-
repositories.getUserPermissionsRepositoriesReturns an object for each repository the caller has explicit access to and their effective permission — the highest level of permission the caller has. This does not return public repositories that the user was not granted any specific permission in, and does not distinguish between explicit and implicit privileges.
Permissions can be:
adminwriteread
Example:
Results may be further by repository or permission by adding the following query string parameters:
q=repository.name="geordi"orq=permission>"read"sort=repository.name
Note that the query parameter values need to be URL escaped so that
=would become%3D.$ curl https://api.bitbucket.org/2.0/user/permissions/repositories { "pagelen": 10, "values": [ { "type": "repository_permission", "user": { "type": "user", "nickname": "evzijst", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "bitbucket/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin" } ], "page": 1, "size": 1} -
repositories.postRepositoriesWorkspaceRepoSlugCreates a new repository.
Note: In order to set the project for the newly created repository, pass in either the project key or the project UUID as part of the request body as shown in the examples below:
or
The project must be assigned for all repositories. If the project is not provided, the repository is automatically assigned to the oldest project in the workspace.
Note: In the examples above, the workspace ID
teamsinspace, and/or the repository namehablandingcan be replaced by UUIDs.$ curl -X POST -H "Content-Type: application/json" -d '{ "scm": "git", "project": { "key": "MARS" }}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding$ curl -X POST -H "Content-Type: application/json" -d '{ "scm": "git", "project": { "key": "{ba516952-992a-4c2d-acbd-17d502922f96}" }}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding -
repositories.postRepositoriesWorkspaceRepoSlugForksCreates a new fork of the specified repository.
Forking a repository
To create a fork, specify the workspace explicitly as part of the request body:
To fork a repository into the same workspace, also specify a new
name.When you specify a value for
name, it will also affect theslug. Theslugis reflected in the repository URL of the new fork. It is derived fromnameby substituting non-ASCII characters, removes whitespace, and changes characters to lower case. For example,My repowould turn intomy_repo.You need contributor access to create new forks within a workspace.
Change the properties of a new fork
By default the fork inherits most of its properties from the parent. However, since the optional POST body document follows the normal
repositoryJSON schema and you can override the new fork's properties.Properties that can be overridden include:
- description
- fork_policy
- language
- mainbranch
- is_private (note that a private repo's fork_policy might prohibit
the creation of public forks, in which
is_private=Falsewould fail) - has_issues (to initialize or disable the new repo's issue tracker -- note that the actual contents of the parent repository's issue tracker are not copied during forking)
- has_wiki (to initialize or disable the new repo's wiki -- note that the actual contents of the parent repository's wiki are not copied during forking)
- project (when forking into a private project, the fork's
is_privatemust betrue)
Properties that cannot be modified include:
- scm
- parent
- full_name
$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \ -H 'Content-Type: application/json' -d '{ "name": "bbql_fork", "workspace": { "slug": "atlassian" }}' -
repositories.postRepositoriesWorkspaceRepoSlugHooksCreates a new webhook on the specified repository.
Example:
Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means:
webhook,repositoryandissue.Also note that the
urlmust properly resolve and cannot be an internal, non-routed address.$ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo-slug/hooks -d ' { "description": "Webhook Description", "url": "https://example.com/", "active": true, "events": [ "repo:push", "issue:created", "issue:updated" ] }' -
repositories.putRepositoriesWorkspaceRepoSlugSince this endpoint can be used to both update and to create a repository, the request body depends on the intent.
Creation
See the POST documentation for the repository endpoint for an example of the request body.
Update
Note: Changing the
nameof the repository will cause the location to be changed. This is because the URL of the repo is derived from the name (a process called slugification). In such a scenario, it is possible for the request to fail if the newly created slug conflicts with an existing repository's slug. But if there is no conflict, the new location will be returned in theLocationheader of the response. -
repositories.putRepositoriesWorkspaceRepoSlugHooksUidUpdates the specified webhook subscription.
The following properties can be mutated:
descriptionurlactiveevents
-
repositories.putRepositoriesWorkspaceRepoSlugOverrideSettings -
repositories.putRepositoriesWorkspaceRepoSlugPermissionsConfigGroupsGroupSlugUpdates the group permission if it exists.
Only users with admin permission for the repository may access this resource.
The only authentication method supported for this endpoint is via app passwords.
Permissions can be:
adminwriteread
Example:
$ curl -X PUT -H "Content-Type: application/json"https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers-d'{ "permission": "write"}' HTTP/1.1 200Location:https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers { "type": "repository_group_permission", "group": { "type": "group", "name": "Developers", "slug": "developers" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/groups/developers" } }} -
repositories.putRepositoriesWorkspaceRepoSlugPermissionsConfigUsersSelectedUserIdUpdates the explicit user permission for a given user and repository. The selected user must be a member of the workspace, and cannot be the workspace owner. Only users with admin permission for the repository may access this resource.
The only authentication method for this endpoint is via app passwords.
Permissions can be:
adminwriteread
Example:
$ curl -X PUT -H "Content-Type: application/json" 'https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a'-d '{ "permission": "write"}' HTTP/1.1 200Location: 'https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a' { "type": "repository_user_permission", "user": { "type": "user", "display_name": "Colin Cameron", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}", "account_id": "557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian_tutorial/geordi/ permissions-config/users/557058:ba8948b2-49da-43a9-9e8b-e7249b8e324a" } }} -
search.searchAccountSearch for code in the repositories of the specified user.
Searching across all repositories:
Note that searches can match in the file's text (
content_matches), the path (path_matches), or both as in the example above.You can use the same syntax for the search query as in the UI, e.g. to only search within a specific repository:
Similar to other APIs, you can request more fields using a
fieldsquery parameter. E.g. to get some more information about the repository of matched files (the%2Bis a URL-encoded+):Try
fields=%2Bvalues.*.*.*.*to get an idea what's possible.curl 'https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/search/code?search_query=foo'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ]}curl 'https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/search/code?search_query=foo+repo:demo'# results from the "demo" repositorycurl 'https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/search/code'\ '?search_query=foo&fields=%2Bvalues.file.commit.repository'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 1, "content_matches": [...], "path_matches": [...], "file": { "commit": { "type": "commit", "hash": "ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/commit/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" }, "html": { "href": "https://bitbucket.org/my-workspace/demo/commits/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" } }, "repository": { "name": "demo", "type": "repository", "full_name": "my-workspace/demo", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo" }, "html": { "href": "https://bitbucket.org/my-workspace/demo" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B850e1749-781a-4115-9316-df39d0600e7a%7D?ts=default" } }, "uuid": "{850e1749-781a-4115-9316-df39d0600e7a}" } }, "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } }, "path": "src/foo.py" } } ]} -
search.searchTeamSearch for code in the repositories of the specified team.
Searching across all repositories:
Note that searches can match in the file's text (
content_matches), the path (path_matches), or both as in the example above.You can use the same syntax for the search query as in the UI, e.g. to only search within a specific repository:
Similar to other APIs, you can request more fields using a
fieldsquery parameter. E.g. to get some more information about the repository of matched files (the%2Bis a URL-encoded+):Try
fields=%2Bvalues.*.*.*.*to get an idea what's possible.curl 'https://api.bitbucket.org/2.0/teams/team_name/search/code?search_query=foo'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ]}curl 'https://api.bitbucket.org/2.0/teams/team_name/search/code?search_query=foo+repo:demo'# results from the "demo" repositorycurl 'https://api.bitbucket.org/2.0/teams/team_name/search/code'\ '?search_query=foo&fields=%2Bvalues.file.commit.repository'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 1, "content_matches": [...], "path_matches": [...], "file": { "commit": { "type": "commit", "hash": "ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/commit/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" }, "html": { "href": "https://bitbucket.org/my-workspace/demo/commits/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" } }, "repository": { "name": "demo", "type": "repository", "full_name": "my-workspace/demo", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo" }, "html": { "href": "https://bitbucket.org/my-workspace/demo" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B850e1749-781a-4115-9316-df39d0600e7a%7D?ts=default" } }, "uuid": "{850e1749-781a-4115-9316-df39d0600e7a}" } }, "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } }, "path": "src/foo.py" } } ]} -
search.searchWorkspaceSearch for code in the repositories of the specified workspace.
Searching across all repositories:
Note that searches can match in the file's text (
content_matches), the path (path_matches), or both as in the example above.You can use the same syntax for the search query as in the UI, e.g. to only search within a specific repository:
Similar to other APIs, you can request more fields using a
fieldsquery parameter. E.g. to get some more information about the repository of matched files (the%2Bis a URL-encoded+):Try
fields=%2Bvalues.*.*.*.*to get an idea what's possible.curl 'https://api.bitbucket.org/2.0/workspaces/workspace_slug_or_uuid/search/code?search_query=foo'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ]}curl 'https://api.bitbucket.org/2.0/workspaces/my-workspace/search/code?search_query=foo+repo:demo'# results from the "demo" repositorycurl 'https://api.bitbucket.org/2.0/workspaces/my-workspace/search/code'\ '?search_query=foo&fields=%2Bvalues.file.commit.repository'{ "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 1, "content_matches": [...], "path_matches": [...], "file": { "commit": { "type": "commit", "hash": "ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/commit/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" }, "html": { "href": "https://bitbucket.org/my-workspace/demo/commits/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b" } }, "repository": { "name": "demo", "type": "repository", "full_name": "my-workspace/demo", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo" }, "html": { "href": "https://bitbucket.org/my-workspace/demo" }, "avatar": { "href": "https://bytebucket.org/ravatar/%7B850e1749-781a-4115-9316-df39d0600e7a%7D?ts=default" } }, "uuid": "{850e1749-781a-4115-9316-df39d0600e7a}" } }, "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } }, "path": "src/foo.py" } } ]} -
snippets.deleteSnippetsWorkspaceEncodedIdDeletes a snippet and returns an empty response.
-
snippets.deleteSnippetsWorkspaceEncodedIdCommentsCommentIdDeletes a snippet comment.
Comments can only be removed by the comment author, snippet creator, or workspace admin.
-
snippets.deleteSnippetsWorkspaceEncodedIdNodeIdDeletes the snippet.
Note that this only works for versioned URLs that point to the latest commit of the snippet. Pointing to an older commit results in a 405 status code.
To delete a snippet, regardless of whether or not concurrent changes are being made to it, use
DELETE /snippets/{encoded_id}instead. -
snippets.deleteSnippetsWorkspaceEncodedIdWatchUsed to stop watching a specific snippet. Returns 204 (No Content) to indicate success.
-
snippets.getSnippetsReturns all snippets. Like pull requests, repositories and workspaces, the full set of snippets is defined by what the current user has access to.
This includes all snippets owned by any of the workspaces the user is a member of, or snippets by other users that the current user is either watching or has collaborated on (for instance by commenting on it).
To limit the set of returned snippets, apply the
?role=[owner|contributor|member]query parameter where the roles are defined as follows:owner: all snippets owned by the current usercontributor: all snippets owned by, or watched by the current usermember: created in a workspaces or watched by the current user
When no role is specified, all public snippets are returned, as well as all privately owned snippets watched or commented on.
The returned response is a normal paginated JSON list. This endpoint only supports
application/jsonresponses and nomultipart/form-dataormultipart/related. As a result, it is not possible to include the file contents. -
snippets.getSnippetsWorkspaceIdentical to , except that the result is further filtered by the snippet owner and only those that are owned by
{workspace}are returned. -
snippets.getSnippetsWorkspaceEncodedIdRetrieves a single snippet.
Snippets support multiple content types:
- application/json
- multipart/related
- multipart/form-data
application/json
The default content type of the response is
application/json. Since JSON is alwaysutf-8, it cannot reliably contain file contents for files that are not text. Therefore, JSON snippet documents only contain the filename and links to the file contents.This means that in order to retrieve all parts of a snippet, N+1 requests need to be made (where N is the number of files in the snippet).
multipart/related
To retrieve an entire snippet in a single response, use the
Accept: multipart/relatedHTTP request header.Response:
multipart/form-data
As with creating new snippets,
multipart/form-datacan be used as an alternative tomultipart/related. However, the inherently flat structure of form-data means that only basic, root-level properties can be returned, while nested elements likelinksare omitted:Response:
$ curl -H "Accept: multipart/related" https://api.bitbucket.org/2.0/snippets/evzijst/1HTTP/1.1 200 OKContent-Length: 2214Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="MIME-Version: 1.0 --===============1438169132528273974==Content-Type: application/json; charset="utf-8"MIME-Version: 1.0Content-ID: snippet { "links": { "self": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj" }, "html": { "href": "https://bitbucket.org/snippets/evzijst/kypj" }, "comments": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj/comments" }, "watchers": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj/watchers" }, "commits": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj/commits" } }, "id": kypj, "title": "My snippet", "created_on": "2014-12-29T22:22:04.790331+00:00", "updated_on": "2014-12-29T22:22:04.790331+00:00", "is_private": false, "files": { "foo.txt": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/foo.txt" }, "html": { "href": "https://bitbucket.org/snippets/evzijst/kypj#file-foo.txt" } } }, "image.png": { "links": { "self": { "href": "https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/image.png" }, "html": { "href": "https://bitbucket.org/snippets/evzijst/kypj#file-image.png" } } } ], "owner": { "username": "evzijst", "nickname": "evzijst", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/evzijst" }, "html": { "href": "https://bitbucket.org/evzijst" }, "avatar": { "href": "https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png" } } }, "creator": { "username": "evzijst", "nickname": "evzijst", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/evzijst" }, "html": { "href": "https://bitbucket.org/evzijst" }, "avatar": { "href": "https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png" } } }} --===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "foo.txt"Content-Disposition: attachment; filename="foo.txt" foo --===============1438169132528273974==Content-Type: image/pngMIME-Version: 1.0Content-Transfer-Encoding: base64Content-ID: "image.png"Content-Disposition: attachment; filename="image.png" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2mTKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TBcbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoINAqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==--===============1438169132528273974==--$ curl -H "Accept: multipart/form-data" https://api.bitbucket.org/2.0/snippets/evzijst/kypjHTTP/1.1 200 OKContent-Length: 951Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59fContent-Disposition: form-data; name="title"Content-Type: text/plain; charset="utf-8" My snippet------------------------------63a4b224c59f--Content-Disposition: attachment; name="file"; filename="foo.txt"Content-Type: text/plain foo ------------------------------63a4b224c59fContent-Disposition: attachment; name="file"; filename="image.png"Content-Transfer-Encoding: base64Content-Type: application/octet-stream iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2mTKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TBcbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoINAqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==------------------------------5957323a6b76-- -
snippets.getSnippetsWorkspaceEncodedIdCommentsUsed to retrieve a paginated list of all comments for a specific snippet.
This resource works identical to commit and pull request comments.
The default sorting is oldest to newest and can be overridden with the
sortquery parameter. -
snippets.getSnippetsWorkspaceEncodedIdCommentsCommentIdReturns the specific snippet comment.
-
snippets.getSnippetsWorkspaceEncodedIdCommitsReturns the changes (commits) made on this snippet.
-
snippets.getSnippetsWorkspaceEncodedIdCommitsRevisionReturns the changes made on this snippet in this commit.
-
snippets.getSnippetsWorkspaceEncodedIdFilesPathConvenience resource for getting to a snippet's raw files without the need for first having to retrieve the snippet itself and having to pull out the versioned file links.
-
snippets.getSnippetsWorkspaceEncodedIdNodeIdIdentical to
GET /snippets/encoded_id, except that this endpoint can be used to retrieve the contents of the snippet as it was at an older revision, while/snippets/encoded_idalways returns the snippet's current revision.Note that only the snippet's file contents are versioned, not its meta data properties like the title.
Other than that, the two endpoints are identical in behavior.
-
snippets.getSnippetsWorkspaceEncodedIdNodeIdFilesPathRetrieves the raw contents of a specific file in the snippet. The
Content-Dispositionheader will be "attachment" to avoid issues with malevolent executable files.The file's mime type is derived from its filename and returned in the
Content-Typeheader.Note that for text files, no character encoding is included as part of the content type.
-
snippets.getSnippetsWorkspaceEncodedIdRevisionDiffReturns the diff of the specified commit against its first parent.
Note that this resource is different in functionality from the
patchresource.The differences between a diff and a patch are:
- patches have a commit header with the username, message, etc
- diffs support the optional
path=foo/bar.pyquery param to filter the diff to just that one file diff (not supported for patches) - for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability).
Note that the character encoding of the contents of the diff is unspecified as Git does not track this, making it hard for Bitbucket to reliably determine this.
-
snippets.getSnippetsWorkspaceEncodedIdRevisionPatchReturns the patch of the specified commit against its first parent.
Note that this resource is different in functionality from the
diffresource.The differences between a diff and a patch are:
- patches have a commit header with the username, message, etc
- diffs support the optional
path=foo/bar.pyquery param to filter the diff to just that one file diff (not supported for patches) - for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability).
Note that the character encoding of the contents of the patch is unspecified as Git does not track this, making it hard for Bitbucket to reliably determine this.
-
snippets.getSnippetsWorkspaceEncodedIdWatchUsed to check if the current user is watching a specific snippet.
Returns 204 (No Content) if the user is watching the snippet and 404 if not.
Hitting this endpoint anonymously always returns a 404.
-
snippets.getSnippetsWorkspaceEncodedIdWatchersReturns a paginated list of all users watching a specific snippet.
-
snippets.postSnippetsCreates a new snippet under the authenticated user's account.
Snippets can contain multiple files. Both text and binary files are supported.
The simplest way to create a new snippet from a local file:
Creating snippets through curl has a few limitations and so let's look at a more complicated scenario.
Snippets are created with a multipart POST. Both
multipart/form-dataandmultipart/relatedare supported. Both allow the creation of snippets with both meta data (title, etc), as well as multiple text and binary files.The main difference is that
multipart/relatedcan use rich encoding for the meta data (currently JSON).multipart/related (RFC-2387)
This is the most advanced and efficient way to create a paste.
The request contains multiple parts and is structured as follows.
The first part is the JSON document that describes the snippet's properties or meta data. It either has to be the first part, or the request's
Content-Typeheader must contain thestartparameter to point to it.The remaining parts are the files of which there can be zero or more. Each file part should contain the
Content-IDMIME header through which the JSON meta data'sfileselement addresses it. The value should be the name of the file.Content-Dispositionis an optional MIME header. The header's optionalfilenameparameter can be used to specify the file name that Bitbucket should use when writing the file to disk. When present,filenametakes precedence over the value ofContent-ID.When the JSON body omits the
fileselement, the remaining parts are not ignored. Instead, each file is added to the new snippet as if its name was explicitly linked (the use of thefileselements is mandatory for some operations like deleting or renaming files).multipart/form-data
The use of JSON for the snippet's meta data is optional. Meta data can also be supplied as regular form fields in a more conventional
multipart/form-datarequest:Here the meta data properties are included as flat, top-level form fields. The file attachments use the
filefield name. To attach multiple files, simply repeat the field.The advantage of
multipart/form-dataovermultipart/relatedis that it can be easier to build clients.Essentially all properties are optional,
titleandfilesincluded.Sharing and Visibility
Snippets can be either public (visible to anyone on Bitbucket, as well as anonymous users), or private (visible only to members of the workspace). This is controlled through the snippet's
is_privateelement:- is_private=false -- everyone, including anonymous users can view the snippet
- is_private=true -- only workspace members can view the snippet
To create the snippet under a workspace, just append the workspace ID to the URL. See .
$ curl -u username:password -X POST https://api.bitbucket.org/2.0/snippets -F file=@image.pngPOST /2.0/snippets/evzijst HTTP/1.1Content-Length: 1188Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="MIME-Version: 1.0 --===============1438169132528273974==Content-Type: application/json; charset="utf-8"MIME-Version: 1.0Content-ID: snippet { "title": "My snippet", "is_private": true, "scm": "git", "files": { "foo.txt": {}, "image.png": {} }} --===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "foo.txt"Content-Disposition: attachment; filename="foo.txt" foo --===============1438169132528273974==Content-Type: image/pngMIME-Version: 1.0Content-Transfer-Encoding: base64Content-ID: "image.png"Content-Disposition: attachment; filename="image.png" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2mTKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TBcbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoINAqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==--===============1438169132528273974==--$ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets -F title="My snippet" -F file=@foo.txt -F file=@image.png POST /2.0/snippets HTTP/1.1Content-Length: 951Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59fContent-Disposition: form-data; name="file"; filename="foo.txt"Content-Type: text/plain foo ------------------------------63a4b224c59fContent-Disposition: form-data; name="file"; filename="image.png"Content-Type: application/octet-stream ?PNG IHDR?1??I.....------------------------------63a4b224c59fContent-Disposition: form-data; name="title" My snippet------------------------------63a4b224c59f-- -
snippets.postSnippetsWorkspaceIdentical to , except that the new snippet will be created under the workspace specified in the path parameter
{workspace}. -
snippets.postSnippetsWorkspaceEncodedIdCommentsCreates a new comment.
The only required field in the body is
content.raw.To create a threaded reply to an existing comment, include
parent.id. -
snippets.putSnippetsWorkspaceEncodedIdUsed to update a snippet. Use this to add and delete files and to change a snippet's title.
To update a snippet, one can either PUT a full snapshot, or only the parts that need to be changed.
The contract for PUT on this API is that properties missing from the request remain untouched so that snippets can be efficiently manipulated with differential payloads.
To delete a property (e.g. the title, or a file), include its name in the request, but omit its value (use
null).As in Git, explicit renaming of files is not supported. Instead, to rename a file, delete it and add it again under another name. This can be done atomically in a single request. Rename detection is left to the SCM.
PUT supports three different content types for both request and response bodies:
application/jsonmultipart/relatedmultipart/form-data
The content type used for the request body can be different than that used for the response. Content types are specified using standard HTTP headers.
Use the
Content-TypeandAcceptheaders to select the desired request and response format.application/json
As with creation and retrieval, the content type determines what properties can be manipulated.
application/jsondoes not support file contents and is therefore limited to a snippet's meta data.To update the title, without changing any of its files:
To delete the title:
Not all parts of a snippet can be manipulated. The owner and creator for instance are immutable.
multipart/related
multipart/relatedcan be used to manipulate all of a snippet's properties. The body is identical to a POST. properties omitted from the request are left unchanged. Since thestartpart contains JSON, the mechanism for manipulating the snippet's meta data is identical toapplication/jsonrequests.To update one of a snippet's file contents, while also changing its title:
Here only the parts that are changed are included in the body. The other files remain untouched.
Note the use of the
fileslist in the JSON part. This list contains the files that are being manipulated. This list should have corresponding multiparts in the request that contain the new contents of these files.If a filename in the
fileslist does not have a corresponding part, it will be deleted from the snippet, as shown below:To simulate a rename, delete a file and add the same file under another name:
multipart/form-data
Again, one can also use
multipart/form-datato manipulate file contents and meta data atomically.To delete a file, omit its contents while including its name in the
filesfield:The explicit use of the
fileselement inmultipart/relatedandmultipart/form-datais only required when deleting files. The default mode of operation is for file parts to be processed, regardless of whether or not they are listed infiles, as a convenience to the client.$ curl -X POST -H "Content-Type: application/json" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{"title": "Updated title"}'$ curl -X POST -H "Content-Type: application/json" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{"title": null}'PUT /2.0/snippets/evzijst/kypj HTTP/1.1Content-Length: 288Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="MIME-Version: 1.0 --===============1438169132528273974==Content-Type: application/json; charset="utf-8"MIME-Version: 1.0Content-ID: snippet { "title": "My updated snippet", "files": { "foo.txt": {} }} --===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "foo.txt"Content-Disposition: attachment; filename="foo.txt" Updated file contents. --===============1438169132528273974==--PUT /2.0/snippets/evzijst/kypj HTTP/1.1Content-Length: 188Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="MIME-Version: 1.0 --===============1438169132528273974==Content-Type: application/json; charset="utf-8"MIME-Version: 1.0Content-ID: snippet { "files": { "image.png": {} }} --===============1438169132528273974==--PUT /2.0/snippets/evzijst/kypj HTTP/1.1Content-Length: 212Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="MIME-Version: 1.0 --===============1438169132528273974==Content-Type: application/json; charset="utf-8"MIME-Version: 1.0Content-ID: snippet { "files": { "foo.txt": {}, "bar.txt": {} }} --===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "bar.txt"Content-Disposition: attachment; filename="bar.txt" foo --===============1438169132528273974==--$ curl -X PUT http://localhost:12345/2.0/snippets/evzijst/kypj -F title="My updated snippet" -F file=@foo.txt PUT /2.0/snippets/evzijst/kypj HTTP/1.1Content-Length: 351Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59fContent-Disposition: form-data; name="file"; filename="foo.txt"Content-Type: text/plain foo ------------------------------63a4b224c59fContent-Disposition: form-data; name="title" My updated snippet------------------------------63a4b224c59f$ curl -X PUT https://api.bitbucket.org/2.0/snippets/evzijst/kypj -F files=image.png PUT /2.0/snippets/evzijst/kypj HTTP/1.1Content-Length: 149Content-Type: multipart/form-data; boundary=----------------------------ef8871065a86 ------------------------------ef8871065a86Content-Disposition: form-data; name="files" image.png------------------------------ef8871065a86-- -
snippets.putSnippetsWorkspaceEncodedIdCommentsCommentIdUpdates a comment.
The only required field in the body is
content.raw.Comments can only be updated by their author.
-
snippets.putSnippetsWorkspaceEncodedIdNodeIdIdentical to
UPDATE /snippets/encoded_id, except that this endpoint takes an explicit commit revision. Only the snippet's "HEAD"/"tip" (most recent) version can be updated and requests on all other, older revisions fail by returning a 405 status.Usage of this endpoint over the unrestricted
/snippets/encoded_idcould be desired if the caller wants to be sure no concurrent modifications have taken place between the moment of the UPDATE request and the original GET.This can be considered a so-called "Compare And Swap", or CAS operation.
Other than that, the two endpoints are identical in behavior.
-
snippets.putSnippetsWorkspaceEncodedIdWatchUsed to start watching a specific snippet. Returns 204 (No Content).
-
source.getRepositoriesWorkspaceRepoSlugFilehistoryCommitPathReturns a paginated list of commits that modified the specified file.
Commits are returned in reverse chronological order. This is roughly equivalent to the following commands:
By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the
?renames=falsequery parameter.Results are returned in descending chronological order by default, and like most endpoints you can the response to only provide exactly the data you want.
For example, if you wanted to find commits made before 2011-05-18 against a file named
README.rst, but you only wanted the path and date, your query would look like this:In the response you can see that the file was renamed to
README.rstby the commit made on 2011-05-16, and was previously namedREADME.txt.$ git log --follow --date-order <sha> <path>$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18'{ "values": [ { "commit": { "date": "2011-05-17T07:32:09+00:00" }, "path": "README.rst" }, { "commit": { "date": "2011-05-16T06:33:28+00:00" }, "path": "README.txt" }, { "commit": { "date": "2011-05-16T06:15:39+00:00" }, "path": "README.txt" } ]} -
source.getRepositoriesWorkspaceRepoSlugSrcThis endpoint redirects the client to the directory listing of the root directory on the main branch.
This is equivalent to directly hitting /2.0/repositories/{username}/{repo_slug}/src/{commit}/{path} [blocked] without having to know the name or SHA1 of the repo's main branch.
To create new commits,
-
source.getRepositoriesWorkspaceRepoSlugSrcCommitPathThis endpoints is used to retrieve the contents of a single file, or the contents of a directory at a specified revision.
Raw file contents
When
pathpoints to a file, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed and as a result no character encoding is included as part of the Content-Type.The
Content-Dispositionheader will be "attachment" to prevent browsers from running executable files.If the file is managed by LFS, then a 301 redirect pointing to Atlassian's media services platform is returned.
The response includes an ETag that is based on the contents of the file and its attributes. This means that an empty
__init__.pyalways returns the same ETag, regardless on the directory it lives in, or the commit it is on.File meta data
When the request for a file path includes the query parameter
?format=meta, instead of returning the file's raw contents, Bitbucket instead returns the JSON object describing the file's properties:File objects contain an
attributeselement that contains a list of possible modifiers. Currently defined values are:link-- indicates that the entry is a symbolic link. The contents of the file represent the path the link points to.executable-- indicates that the file has the executable bit set.subrepository-- indicates that the entry points to a submodule or subrepo. The contents of the file is the SHA1 of the repository pointed to.binary-- indicates whether Bitbucket thinks the file is binary.
This endpoint can provide an alternative to how a HEAD request can be used to check for the existence of a file, or a file's size without incurring the overhead of receiving its full contents.
Directory listings
When
pathpoints to a directory instead of a file, the response is a paginated list of directory and file objects in the same order as the underlying SCM system would return them.For example:
When listing the contents of the repo's root directory, the use of a trailing slash at the end of the URL is required.
The response by default is not recursive, meaning that only the direct contents of a path are returned. The response does not recurse down into subdirectories. In order to "walk" the entire directory tree, the client can either parse each response and follow the
selflinks of eachcommit_directoryobject, or can specify amax_depthto recurse to.The max_depth parameter will do a breadth-first search to return the contents of the subdirectories up to the depth specified. Breadth-first search was chosen as it leads to the least amount of file system operations for git. If the
max_depthparameter is specified to be too large, the call will time out and return a 555.Each returned object is either a
commit_file, or acommit_directory, both of which contain apathelement. This path is the absolute path from the root of the repository. Each object also contains acommitobject which embeds the commit the file is on. Note that this is merely the commit that was used in the URL. It is not the commit that last modified the file.Directory objects have 2 representations. Their
selflink returns the paginated contents of the directory. Themetalink on the other hand returns the actualdirectoryobject itself, e.g.:Querying, filtering and sorting
Like most API endpoints, this API supports the Bitbucket querying/filtering syntax and so you could filter a directory listing to only include entries that match certain criteria. For instance, to list all binary files over 1kb use the expression:
size > 1024 and attributes = "binary"which after urlencoding yields the query string:
?q=size%3E1024+and+attributes%3D%22binary%22To change the ordering of the response, use the
?sortparameter:.../src/eefd5ef/?sort=-sizeSee for more details.
$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta{ "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py" }, "meta": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta" } }, "path": "tests/__init__.py", "commit": { "type": "commit", "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335" }, "html": { "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335" } } }, "attributes": [], "type": "commit_file", "size": 0}$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests{ "pagelen": 10, "values": [ { "path": "tests/test_project", "type": "commit_directory", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/" }, "meta": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta" } }, "commit": { "type": "commit", "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335" }, "html": { "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335" } } } }, { "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py" }, "meta": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta" } }, "path": "tests/__init__.py", "commit": { "type": "commit", "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335" }, "html": { "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335" } } }, "attributes": [], "type": "commit_file", "size": 0 } ], "page": 1, "size": 2}{ "path": "tests/test_project", "type": "commit_directory", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/" }, "meta": { "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta" } }, "commit": { ... }} -
source.postRepositoriesWorkspaceRepoSlugSrcThis endpoint is used to create new commits in the repository by uploading files.
To add a new file to a repository:
This will create a new commit on top of the main branch, inheriting the contents of the main branch, but adding (or overwriting) the
image.pngfile to the repository in the/repo/path/todirectory.To create a commit that deletes files, use the
filesparameter:You can add/modify/delete multiple files in a request. Rename/move a file by deleting the old path and adding the content at the new path.
This endpoint accepts
multipart/form-data(as in the examples above), as well asapplication/x-www-form-urlencoded.multipart/form-data
A
multipart/form-datapost contains a series of "form fields" that identify both the individual files that are being uploaded, as well as additional, optional meta data.Files are uploaded in file form fields (those that have a
Content-Dispositionparameter) whose field names point to the remote path in the repository where the file should be stored. Path field names are always interpreted to be absolute from the root of the repository, regardless whether the client uses a leading slash (as the abovecurlexample did).File contents are treated as bytes and are not decoded as text.
The commit message, as well as other non-file meta data for the request, is sent along as normal form field elements. Meta data fields share the same namespace as the file objects. For
multipart/form-databodies that should not lead to any ambiguity, as theContent-Dispositionheader will contain thefilenameparameter to distinguish between a file named "message" and the commit message field.application/x-www-form-urlencoded
It is also possible to upload new files using a simple
application/x-www-form-urlencodedPOST. This can be convenient when uploading pure text files:There could be a field name clash if a client were to upload a file named "message", as this filename clashes with the meta data property for the commit message. To avoid this and to upload files whose names clash with the meta data properties, use a leading slash for the files, e.g.
curl --data-urlencode "/message=file contents".When an explicit slash is omitted for a file whose path matches that of a meta data parameter, then it is interpreted as meta data, not as a file.
Executables and links
While this API aims to facilitate the most common use cases, it is possible to perform some more advanced operations like creating a new symlink in the repository, or creating an executable file.
Files can be supplied with a
x-attributesvalue in theContent-Dispositionheader. For example, to upload an executable file, as well as create a symlink fromREADME.txttoREADME:Links are files that contain the target path and have
x-attributes:"link"set.When overwriting links with files, or vice versa, the newly uploaded file determines both the new contents, as well as the attributes. That means uploading a file without specifying
x-attributes="link"will create a regular file, even if the parent commit hosted a symlink at the same path.The same applies to executables. When modifying an existing executable file, the form-data file element must include
x-attributes="executable"in order to preserve the executable status of the file.Note that this API does not support the creation or manipulation of subrepos / submodules.
$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \ -F /repo/path/to/image.png=@image.png$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \ -F files=/file/to/delete/1.txt \ -F files=/file/to/delete/2.txt$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src \ --data-urlencode "/path/to/me.txt=Lorem ipsum." \ --data-urlencode "message=Initial commit" \ --data-urlencode "author=Erik van Zijst <erik.van.zijst@gmail.com>"--===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "bin/shutdown.sh"Content-Disposition: attachment; filename="shutdown.sh"; x-attributes:"executable" #!/bin/shhalt --===============1438169132528273974==Content-Type: text/plain; charset="us-ascii"MIME-Version: 1.0Content-Transfer-Encoding: 7bitContent-ID: "/README.txt"Content-Disposition: attachment; filename="README.txt"; x-attributes:"link" README--===============1438169132528273974==-- -
ssh.deleteUsersSelectedUserSshKeysKeyIdDeletes a specific SSH public key from a user's account
Example:
-
ssh.getUsersSelectedUserSshKeysReturns a paginated list of the user's SSH public keys.
Example:
$ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys{ "page": 1, "pagelen": 10, "size": 1, "values": [ { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}" } ]} -
ssh.getUsersSelectedUserSshKeysKeyIdReturns a specific SSH public key belonging to a user.
Example:
$ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3} { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}"} -
ssh.postUsersSelectedUserSshKeysAdds a new SSH public key to the specified user account and returns the resulting key.
Example:
$ curl -X POST -H "Content-Type: application/json" -d '{"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys { "comment": "user@myhost", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}"} -
ssh.putUsersSelectedUserSshKeysKeyIdUpdates a specific SSH public key on a user's account
Note: Only the 'comment' field can be updated using this API. To modify the key or comment values, you must delete and add the key again.
Example:
$ curl -X PUT -H "Content-Type: application/json" -d '{"label": "Work key"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} { "comment": "", "created_on": "2018-03-14T13:17:05.196003+00:00", "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY", "label": "Work key", "last_used": "2018-03-20T13:18:05.196003+00:00", "links": { "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a" } }, "owner": { "display_name": "Mark Adams", "links": { "avatar": { "href": "https://bitbucket.org/account/markadams-atl/avatar/32/" }, "html": { "href": "https://bitbucket.org/markadams-atl/" }, "self": { "href": "https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}" } }, "type": "user", "username": "markadams-atl", "nickname": "markadams-atl", "uuid": "{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}" }, "type": "ssh_key", "uuid": "{b15b6026-9c02-4626-b4ad-b905f99f763a}"} -
users.getUserReturns the currently logged in user.
-
users.getUserEmailsReturns all the authenticated user's email addresses. Both confirmed and unconfirmed.
-
users.getUserEmailsEmailReturns details about a specific one of the authenticated user's email addresses.
Details describe whether the address has been confirmed by the user and whether it is the user's primary address or not.
-
users.getUsersSelectedUserGets the public information associated with a user account.
If the user's profile is private,
location,websiteandcreated_onelements are omitted.Note that the user object returned by this operation is changing significantly, due to privacy changes. See the for details.
-
webhooks.getHookEventsReturns the webhook resource or subject types on which webhooks can be registered.
Each resource/subject type contains an
eventslink that returns the paginated list of specific events each individual subject type can emit.This endpoint is publicly accessible and does not require authentication or scopes.
Example:
$ curl https://api.bitbucket.org/2.0/hook_events { "repository": { "links": { "events": { "href": "https://api.bitbucket.org/2.0/hook_events/repository" } } }, "workspace": { "links": { "events": { "href": "https://api.bitbucket.org/2.0/hook_events/workspace" } } }} -
webhooks.getHookEventsSubjectTypeReturns a paginated list of all valid webhook events for the specified entity. The team and user webhooks are deprecated, and you should use workspace instead. For more information, see .
This is public data that does not require any scopes or authentication.
Example:
NOTE: The following example is a truncated response object for the
workspacesubject_type. We return the same structure for the othersubject_typeobjects.$ curl https://api.bitbucket.org/2.0/hook_events/workspace{ "page": 1, "pagelen": 30, "size": 21, "values": [ { "category": "Repository", "description": "Whenever a repository push occurs", "event": "repo:push", "label": "Push" }, { "category": "Repository", "description": "Whenever a repository fork occurs", "event": "repo:fork", "label": "Fork" }, { "category": "Repository", "description": "Whenever a repository import occurs", "event": "repo:imported", "label": "Import" }, ... { "category":"Pull Request", "label":"Approved", "description":"When someone has approved a pull request", "event":"pullrequest:approved" }, ]} -
workspaces.deleteWorkspacesWorkspaceHooksUidDeletes the specified webhook subscription from the given workspace.
-
workspaces.getUserPermissionsWorkspacesReturns an object for each workspace the caller is a member of, and their effective role - the highest level of privilege the caller has. If a user is a member of multiple groups with distinct roles, only the highest level is returned.
Permissions can be:
ownercollaboratormember
The
collaboratorrole is being removed from the Bitbucket Cloud API. For more information, see the .Example:
Results may be further by workspace or permission by adding the following query string parameters:
q=workspace.slug="bbworkspace1"orq=permission="owner"sort=workspace.slug
Note that the query parameter values need to be URL escaped so that
=would become%3D.$ curl https://api.bitbucket.org/2.0/user/permissions/workspaces { "pagelen": 10, "page": 1, "size": 1, "values": [ { "type": "workspace_membership", "permission": "owner", "last_accessed": "2019-03-07T12:35:02.900024+00:00", "added_on": "2018-10-11T17:42:02.961424+00:00", "user": { "type": "user", "uuid": "{470c176d-3574-44ea-bb41-89e8638bcca4}", "nickname": "evzijst", "display_name": "Erik van Zijst", }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket", } } ]} -
workspaces.getWorkspacesReturns a list of workspaces accessible by the authenticated user.
Example:
Results may be further by workspace or permission by adding the following query string parameters:
q=slug="bbworkspace1"orq=is_private=truesort=created_on
Note that the query parameter values need to be URL escaped so that
=would become%3D.The
collaboratorrole is being removed from the Bitbucket Cloud API. For more information, see the .$ curl https://api.bitbucket.org/2.0/workspaces { "pagelen": 10, "page": 1, "size": 1, "values": [ { "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "links": { "owners": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/members?q=permission%3D%22owner%22" }, "self": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1" }, "repositories": { "href": "https://api.bitbucket.org/2.0/repositories/bbworkspace1" }, "snippets": { "href": "https://api.bitbucket.org/2.0/snippets/bbworkspace1" }, "html": { "href": "https://bitbucket.org/bbworkspace1/" }, "avatar": { "href": "https://bitbucket.org/workspaces/bbworkspace1/avatar/?ts=1543465801" }, "members": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/members" }, "projects": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/projects" } }, "created_on": "2018-11-14T19:15:05.058566+00:00", "type": "workspace", "slug": "bbworkspace1", "is_private": true, "name": "Atlassian Bitbucket" } ]} -
workspaces.getWorkspacesWorkspaceReturns the requested workspace.
-
workspaces.getWorkspacesWorkspaceHooksReturns a paginated list of webhooks installed on this workspace.
-
workspaces.getWorkspacesWorkspaceHooksUidReturns the webhook with the specified id installed on the given workspace.
-
workspaces.getWorkspacesWorkspaceMembersReturns all members of the requested workspace.
-
workspaces.getWorkspacesWorkspaceMembersMemberReturns the workspace membership, which includes a
Userobject for the member and aWorkspaceobject for the requested workspace. -
workspaces.getWorkspacesWorkspacePermissionsReturns the list of members in a workspace and their permission levels. Permission can be:
ownercollaboratormember
The
collaboratorrole is being removed from the Bitbucket Cloud API. For more information, see the .Example:
Results may be further by permission by adding the following query string parameters:
q=permission="owner"
$ curl -X https://api.bitbucket.org/2.0/workspaces/bbworkspace1/permissions { "pagelen": 10, "values": [ { "permission": "owner", "type": "workspace_membership", "user": { "type": "user", "uuid": "{470c176d-3574-44ea-bb41-89e8638bcca4}", "display_name": "Erik van Zijst", }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket", } }, { "permission": "member", "type": "workspace_membership", "user": { "type": "user", "nickname": "seanaty", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket", } } ], "page": 1, "size": 2} -
workspaces.getWorkspacesWorkspacePermissionsRepositoriesReturns an object for each repository permission for all of a workspace's repositories.
Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.
Only users with admin permission for the team may access this resource.
Permissions can be:
adminwriteread
Example:
Results may be further by repository, user, or permission by adding the following query string parameters:
q=repository.name="geordi"orq=permission>"read"sort=user.display_name
Note that the query parameter values need to be URL escaped so that
=would become%3D.$ curl https://api.bitbucket.org/2.0/workspaces/atlassian_tutorial/permissions/repositories { "pagelen": 10, "values": [ { "type": "repository_permission", "user": { "type": "user", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Jeff Zeng", "uuid": "{47f92a9a-c3a3-4d0b-bc4e-782a969c5c72}" }, "repository": { "type": "repository", "name": "whee", "full_name": "atlassian_tutorial/whee", "uuid": "{30ba25e9-51ff-4555-8dd0-fc7ee2fa0895}" }, "permission": "admin" } ], "page": 1, "size": 3} -
workspaces.getWorkspacesWorkspacePermissionsRepositoriesRepoSlugReturns an object for the repository permission of each user in the requested repository.
Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.
Only users with admin permission for the repository may access this resource.
Permissions can be:
adminwriteread
Example:
Results may be further by user, or permission by adding the following query string parameters:
q=permission>"read"sort=user.display_name
Note that the query parameter values need to be URL escaped so that
=would become%3D.$ curl https://api.bitbucket.org/2.0/workspaces/atlassian_tutorial/permissions/repositories/geordi { "pagelen": 10, "values": [ { "type": "repository_permission", "user": { "type": "user", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write" } ], "page": 1, "size": 2} -
workspaces.getWorkspacesWorkspaceProjectsReturns the list of projects in this workspace.
-
workspaces.postWorkspacesWorkspaceHooksCreates a new webhook on the specified workspace.
Workspace webhooks are fired for events from all repositories contained by that workspace.
Example:
This call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means:
webhook,repositoryandissue.The
urlmust properly resolve and cannot be an internal, non-routed address.Only workspace owners can install webhooks on workspaces.
$ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/workspaces/my-workspace/hooks -d ' { "description": "Webhook Description", "url": "https://example.com/", "active": true, "events": [ "repo:push", "issue:created", "issue:updated" ] }' -
workspaces.putWorkspacesWorkspaceHooksUidUpdates the specified webhook subscription.
The following properties can be mutated:
descriptionurlactiveevents
-
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools