Pullrequests 8 endpoints

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
operationId: Pullrequests_removeChangeRequest

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

workspace path required string

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

Responses

204

An empty response indicating the authenticated user’s request for change has been withdrawn.

400

Pull request requested changes cannot be removed because the pull request has already been merged.

401

The request wasn’t authenticated.

404

The specified pull request or the repository does not exist.

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
operationId: Pullrequests_requestChanges

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

workspace path required string

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

Responses

200

The participant object recording that the authenticated user requested changes on the pull request.

400

Pull request changes cannot be requested because the pull request has already been merged.

401

The request wasn’t authenticated.

404

The specified pull request or the repository does not exist.

POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/statuses

Returns all statuses (e.g. build results) for the given pull
request.

operationId: Pullrequests_listCommitStatuses

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

workspace path required string

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

q query optional string

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

sort query optional string

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

Responses

200

A paginated list of all commit statuses for this pull request.

401

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

404

If the specified repository or pull request does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/statuses
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks

Returns a paginated list of the pull request’s tasks.

This endpoint supports filtering and sorting of the results by the ‘task’ field.
See filtering and sorting for more details.

operationId: Pullrequests_listTasksOnPullRequest

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

workspace path required string

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

q query optional string

Query string to narrow down the response. See
filtering and sorting for details.

sort query optional string

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

pagelen query optional integer

Current number of objects on the existing page.
The default value is 10 with 100 being the maximum allowed value.
Individual APIs may enforce different values.

Responses

200

A paginated list of pull request tasks for the given pull request.

400

If the user provides an invalid filter, sort, or fields query parameter.

403

If the authenticated user does not have access to the pull request.

404

If the pull request does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks

Creates a new pull request task.

Returns the newly created pull request task.

Tasks can optionally be created in relation to a comment specified by the comment’s ID which
will cause the task to appear below the comment on a pull request when viewed in Bitbucket.

operationId: Pullrequests_createTask

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

workspace path required string

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

Request Body

required

The contents of the task

application/json
schema A_pullrequest_task_create
Property Type Required
comment object optional
type string required
id integer optional
user object optional
type string required
uuid string optional
links object optional
avatar object optional
username string optional
created_on string optional
display_name string optional
links object optional
code object optional
href string optional
name string optional
html object optional
href string optional
name string optional
self object optional
href string optional
name string optional
inline object optional
to integer optional
from integer optional
path string required
parent object optional
content object optional
raw string optional
html string optional
markup string optional
deleted boolean optional
created_on string optional
updated_on string optional
content object required
raw string required
pending boolean optional

Responses

201

The newly created task.

400

There is a missing required field in the request or the task content is blank.

403

If the authenticated user does not have access to the pull request.

404

If the pull request does not exist.

POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}

Deletes a specific pull request task.

operationId: Pullrequests_deleteTask

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

task_id path required integer

The ID of the task.

workspace path required string

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

Responses

204

Successful deletion.

403

If the authenticated user does not have access to delete the task.

404

If the task does not exist.

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}

Returns a specific pull request task.

operationId: Pullrequests_getTask

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

task_id path required integer

The ID of the task.

workspace path required string

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

Responses

200

The task.

403

If the authenticated user does not have access to the pull request.

404

If the task does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}
PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}

Updates a specific pull request task.

operationId: Pullrequests_updateTask

Parameters

Name In Required Type Description
pull_request_id path required integer

The id of the pull request.

repo_slug path required string

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

task_id path required integer

The ID of the task.

workspace path required string

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

Request Body

required

The updated state and content of the task.

application/json
schema A_pullrequest_task_update
Property Type Required
state string optional
content object optional
raw string required

Responses

200

The updated task.

400

There is a missing required field in the request or the task content is blank.

403

If the authenticated user does not have access to the pull request.

404

If the task does not exist.

PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks/{task_id}

Refs 9 endpoints

GET /repositories/{workspace}/{repo_slug}/refs

Returns 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.

operationId: Refs_listBranchesAndTags

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

q query optional string

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

sort query optional string

Field by which the results should be sorted as per
filtering and sorting. The name
field is handled specially for refs in that, if specified as the sort field, it
uses a natural sort order instead of the default lexicographical sort order. For example,
it will return [‘1.1’, ‘1.2’, ‘1.10’] instead of [‘1.1’, ‘1.10’, ‘1.2’].

Responses

200

A paginated list of refs matching any filter criteria that were provided.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/refs
GET /repositories/{workspace}/{repo_slug}/refs/branches

Returns a list of all open branches within the specified repository.
Results will be in the order the source control manager returns them.

Branches support filtering and sorting
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.

operationId: Refs_listOpenBranches

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

q query optional string

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

sort query optional string

Field by which the results should be sorted as per
filtering and sorting. The name
field is handled specially for branches in that, if specified as the sort field, it
uses a natural sort order instead of the default lexicographical sort order. For example,
it will return [‘branch1’, ‘branch2’, ‘branch10’] instead of [‘branch1’, ‘branch10’, ‘branch2’].

Responses

200

A paginated list of branches matching any filter criteria that were provided.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/refs/branches
POST /repositories/{workspace}/{repo_slug}/refs/branches

Creates 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.

curl https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/branches \
-s -u seanfarley -X POST -H "Content-Type: application/json" \
-d '{
    "name" : "smf/create-feature",
    "target" : {
        "hash" : "default",
    }
}'

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.

operationId: Refs_createBranch

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

201

The newly created branch object.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository or branch does not exist.

POST /repositories/{workspace}/{repo_slug}/refs/branches
DELETE /repositories/{workspace}/{repo_slug}/refs/branches/{name}

Delete 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).

operationId: Refs_deleteBranch

Parameters

Name In Required Type Description
name path required string

The name of the branch.

repo_slug path required string

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

workspace path required string

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

Responses

204

Indicates that the specified branch was successfully deleted.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository or branch does not exist.

DELETE /repositories/{workspace}/{repo_slug}/refs/branches/{name}
GET /repositories/{workspace}/{repo_slug}/refs/branches/{name}

Returns a branch object within the specified repository.

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).

operationId: Refs_getBranch

Parameters

Name In Required Type Description
name path required string

The name of the branch.

repo_slug path required string

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

workspace path required string

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

Responses

200

The branch object.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository or branch does not exist.

GET /repositories/{workspace}/{repo_slug}/refs/branches/{name}
GET /repositories/{workspace}/{repo_slug}/refs/tags

Returns 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.

operationId: Refs_listTags

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

q query optional string

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

sort query optional string

Field by which the results should be sorted as per
filtering and sorting. The name
field is handled specially for tags in that, if specified as the sort field, it
uses a natural sort order instead of the default lexicographical sort order. For example,
it will return [‘1.1’, ‘1.2’, ‘1.10’] instead of [‘1.1’, ‘1.10’, ‘1.2’].

Responses

200

A paginated list of tags matching any filter criteria that were provided.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/refs/tags
POST /repositories/{workspace}/{repo_slug}/refs/tags

Creates 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.

curl https://api.bitbucket.org/2.0/repositories/jdoe/myrepo/refs/tags \
-s -u jdoe -X POST -H "Content-Type: application/json" \
-d '{
    "name" : "new-tag-name",
    "target" : {
        "hash" : "a1b2c3d4e5f6",
    }
}'

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.

operationId: Refs_createTag

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Request Body

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

Responses

201

The newly created tag.

400

If the target hash is missing, ambiguous, or invalid, or if the name is not provided.

POST /repositories/{workspace}/{repo_slug}/refs/tags
DELETE /repositories/{workspace}/{repo_slug}/refs/tags/{name}

Delete a tag in the specified repository.

The tag name should not include any prefixes (e.g. refs/tags).

operationId: Refs_deleteTag

Parameters

Name In Required Type Description
name path required string

The name of the tag.

repo_slug path required string

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

workspace path required string

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

Responses

204

Indicates the specified tag was successfully deleted.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository or tag does not exist.

DELETE /repositories/{workspace}/{repo_slug}/refs/tags/{name}
GET /repositories/{workspace}/{repo_slug}/refs/tags/{name}

Returns 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"
  }
}
operationId: Refs_tagsByNameGet

Parameters

Name In Required Type Description
name path required string

The name of the tag.

repo_slug path required string

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

workspace path required string

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

Responses

200

The tag object.

403

If the repository is private and the authenticated user does not have
access to it.

404

The specified repository or tag does not exist.

GET /repositories/{workspace}/{repo_slug}/refs/tags/{name}

Reports 9 endpoints

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

Returns a paginated list of Reports linked to this commit.

operationId: Reports_listLinkedReports

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit for which to retrieve reports.

Responses

200

OK

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports
DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}

Deletes a single Report matching the provided ID.

operationId: Reports_deleteReport

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the report belongs to.

reportId path required string

Either the uuid or external-id of the report.

Responses

204

No content

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}

Returns a single Report matching the provided ID.

operationId: Reports_getSingleReport

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the report belongs to.

reportId path required string

Either the uuid or external-id of the report.

Responses

200

OK

404

The report with the given ID was not found.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}

Creates 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:

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
        }
    ]
}'

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

| Type Field | Value Field Type | Value Field Display |
|:————–|:——————|:——————–|
| None/ Omitted | Number, String or Boolean (not an array or object) | Plain text |
| BOOLEAN | Boolean | The value will be read as a JSON boolean and displayed as ‘Yes’ or ‘No’. |
| DATE | Number | The value will be read as a JSON number in the form of a Unix timestamp (milliseconds) and will be displayed as a relative date if the date is less than one week ago, otherwise it will be displayed as an absolute date. |
| DURATION | Number | The value will be read as a JSON number in milliseconds and will be displayed in a human readable duration format. |
| LINK | Object: {"text": "Link text here", "href": "https://link.to.annotation/in/external/tool"} | The value will be read as a JSON object containing the fields “text” and “href” and will be displayed as a clickable link on the report. |
| NUMBER | Number | The value will be read as a JSON number and large numbers will be displayed in a human readable format (e.g. 14.3k). |
| PERCENTAGE | Number (between 0 and 100) | The value will be read as a JSON number between 0 and 100 and will be displayed with a percentage sign. |
| TEXT | String | The value will be read as a JSON string and will be displayed as-is |

Please refer to the Code Insights documentation for more information.

operationId: Reports_commitReportCreateOrUpdate

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the report belongs to.

reportId path required string

Either the uuid or external-id of the report.

Request Body

required

The report to create or update

application/json
schema report
Property Type Required
type string required
data array optional
type string optional
title string optional
value object optional
link string optional
uuid string optional
title string optional
result string optional
details string optional
logo_url string optional
reporter string optional
created_on string optional
updated_on string optional
external_id string optional
report_type string optional
remote_link_enabled boolean optional

Responses

200

OK

400

The provided Report object is malformed or incomplete.

PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations

Returns a paginated list of Annotations for a specified report.

operationId: Reports_listAnnotations

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit for which to retrieve reports.

reportId path required string

Uuid or external-if of the report for which to get annotations for.

Responses

200

OK

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations

Bulk 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 UUID. You can upload up to 100 annotations per POST request.

Sample cURL request:

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
  }
]'

Possible field values:

annotation_type: VULNERABILITY, CODE_SMELL, BUG
result: PASSED, FAILED, IGNORED, SKIPPED
severity: HIGH, MEDIUM, LOW, CRITICAL

Please refer to the Code Insights documentation for more information.

operationId: Reports_bulkCreateOrUpdateAnnotations

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit for which to retrieve reports.

reportId path required string

Uuid or external-if of the report for which to get annotations for.

Request Body

required

The annotations to create or update

application/json
schema ReportsBulkCreateOrUpdateAnnotationsRequest
array of object
Property Type Required
type string required
line integer optional
link string optional
path string optional
uuid string optional
result string optional
details string optional
summary string optional
severity string optional
created_on string optional
updated_on string optional
external_id string optional
annotation_type string optional

Responses

200

OK

POST /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}

Deletes a single Annotation matching the provided ID.

operationId: Reports_deleteAnnotation

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the annotation belongs to.

reportId path required string

Either the uuid or external-id of the annotation.

annotationId path required string

Either the uuid or external-id of the annotation.

Responses

204

No content

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}

Returns a single Annotation matching the provided ID.

operationId: Reports_getAnnotation

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the report belongs to.

reportId path required string

Either the uuid or external-id of the report.

annotationId path required string

Either the uuid or external-id of the annotation.

Responses

200

OK

404

The annotation with the given ID was not found.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}
PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}

Creates 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 UUID. 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:

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
}'

Possible field values:

annotation_type: VULNERABILITY, CODE_SMELL, BUG
result: PASSED, FAILED, IGNORED, SKIPPED
severity: HIGH, MEDIUM, LOW, CRITICAL

Please refer to the Code Insights documentation for more information.

operationId: Reports_commitAnnotations

Parameters

Name In Required Type Description
workspace path required string

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

repo_slug path required string

The repository.

commit path required string

The commit the report belongs to.

reportId path required string

Either the uuid or external-id of the report.

annotationId path required string

Either the uuid or external-id of the annotation.

Request Body

required

The annotation to create or update

application/json
schema report_annotation
Property Type Required
type string required
line integer optional
link string optional
path string optional
uuid string optional
result string optional
details string optional
summary string optional
severity string optional
created_on string optional
updated_on string optional
external_id string optional
annotation_type string optional

Responses

200

OK

400

The provided Annotation object is malformed or incomplete.

PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}

Repositories 24 endpoints

GET /repositories

Returns a paginated list of all public repositories.

This endpoint also supports filtering and sorting of the results. See
filtering and sorting for more details.

operationId: Repositories_listPublicRepositories

Parameters

Name In Required Type Description
after query optional string

Filter the results to include only repositories created on or
after this ISO-8601
timestamp. Example: YYYY-MM-DDTHH:mm:ss.sssZ

role query optional string

Filters the result based on the authenticated user’s role on each repository.

  • member: returns repositories to which the user has explicit read access
  • contributor: returns repositories to which the user has explicit write access
  • admin: returns repositories to which the user has explicit administrator access
  • owner: returns all repositories owned by the current user
q query optional string

Query string to narrow down the response as per filtering and sorting.
role parameter must also be specified.

sort query optional string

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

Responses

200

All public repositories.

GET /repositories
GET /repositories/{workspace}

Returns 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
filtering and sorting for more details.

operationId: Repositories_listInWorkspace

Parameters

Name In Required Type Description
workspace path required string

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

role query optional string

Filters the result based on the authenticated user’s role on each repository.

  • member: returns repositories to which the user has explicit read access
  • contributor: returns repositories to which the user has explicit write access
  • admin: returns repositories to which the user has explicit administrator access
  • owner: returns all repositories owned by the current user
q query optional string

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

sort query optional string

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

Responses

200

The repositories owned by the specified account.

404

If the specified account does not exist.

410

If the specified account marked as spam.

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

Deletes the repository. This is an irreversible operation.

This does not affect its forks.

operationId: Repositories_deleteRepository

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

redirect_to query optional string

If a repository has been moved to a new location, use this parameter to
show users a friendly message in the Bitbucket UI that the repository
has moved to a new location. However, a GET to this endpoint will still
return a 404.

Responses

204

Indicates successful deletion.

403

If the caller either does not have admin access to the repository, or the repository is set to read-only.

404

If the repository does not exist.

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

Returns the object describing this repository.

operationId: Repositories_getRepositoryDetails

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

The repository object.

403

If the repository is private and the authenticated user does not have access to it.

404

If no repository exists at this location.

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

Creates 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:

$ curl -X POST -H "Content-Type: application/json" -d '{
    "scm": "git",
    "project": {
        "key": "MARS"
    }
}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding

or

$ 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

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 name hablanding can be replaced by UUIDs.

operationId: Repositories_createRepo

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Request Body

The repository that is to be created. Note that most object elements are optional. Elements “owner” and “full_name” are ignored as the URL implies them.

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

Responses

200

The newly created repository.

400

If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.

401

If the request was not authenticated.

POST /repositories/{workspace}/{repo_slug}
PUT /repositories/{workspace}/{repo_slug}

Since 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 name of 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 the Location header of the
response.

operationId: Repositories_createOrUpdate

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Request Body

The repository that is to be updated.

Note that the elements “owner” and “full_name” are ignored since the
URL implies them.

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

Responses

200

The existing repository has been updated

201

A new repository has been created

400

If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.

401

If the request was not authenticated.

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

Returns a paginated list of all the forks of the specified
repository.

operationId: Repositories_listForks

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

role query optional string

Filters the result based on the authenticated user’s role on each repository.

  • member: returns repositories to which the user has explicit read access
  • contributor: returns repositories to which the user has explicit write access
  • admin: returns repositories to which the user has explicit administrator access
  • owner: returns all repositories owned by the current user
q query optional string

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

sort query optional string

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

Responses

200

All forks.

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

Creates a new fork of the specified repository.

Forking a repository

To create a fork, specify the workspace explicitly as part of the
request body:

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

To fork a repository into the same workspace, also specify a new name.

When you specify a value for name, it will also affect the slug.
The slug is reflected in the repository URL of the new fork. It is
derived from name by substituting non-ASCII characters, removes
whitespace, and changes characters to lower case. For example,
My repo would turn into my_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
repository JSON 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=False would 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_private
    must be true)

Properties that cannot be modified include:

  • scm
  • parent
  • full_name
operationId: Repositories_forkRepository

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Request Body

A repository object. This can be left blank.

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

Responses

201

The newly created fork.

POST /repositories/{workspace}/{repo_slug}/forks
GET /repositories/{workspace}/{repo_slug}/hooks

Returns a paginated list of webhooks installed on this repository.

operationId: Repositories_listWebhooks

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

The paginated list of installed webhooks.

403

If the authenticated user does not have permission to access the webhooks.

404

If the repository does not exist.

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

Creates a new webhook on the specified repository.

Example:

$ 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,
      "secret": "this is a really bad secret",
      "events": [
        "repo:push",
        "issue:created",
        "issue:updated"
      ]
    }'

When the secret is provided it will be used as the key to generate a HMAC
digest value sent in the X-Hub-Signature header at delivery time. Passing
a null or empty secret or not passing a secret will leave the webhook’s
secret unset. Bitbucket only generates the X-Hub-Signature when the webhook’s
secret is set.

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, repository and issue.

Also note that the url must properly resolve and cannot be an
internal, non-routed address.

operationId: Repositories_createWebhook

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

201

If the webhook was registered successfully.

403

If the authenticated user does not have permission to install webhooks on the specified repository.

404

If the repository does not exist.

POST /repositories/{workspace}/{repo_slug}/hooks
DELETE /repositories/{workspace}/{repo_slug}/hooks/{uid}

Deletes the specified webhook subscription from the given
repository.

operationId: Repositories_deleteWebhook

Parameters

Name In Required Type Description
repo_slug path required string

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

uid path required string

Installed webhook’s ID

workspace path required string

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

Responses

204

When the webhook was deleted successfully

403

If the authenticated user does not have permission to delete the webhook.

404

If the webhook or repository does not exist.

DELETE /repositories/{workspace}/{repo_slug}/hooks/{uid}
GET /repositories/{workspace}/{repo_slug}/hooks/{uid}

Returns the webhook with the specified id installed on the specified
repository.

operationId: Repositories_getWebhookByUid

Parameters

Name In Required Type Description
repo_slug path required string

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

uid path required string

Installed webhook’s ID

workspace path required string

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

Responses

200

The webhook subscription object.

404

If the webhook or repository does not exist.

GET /repositories/{workspace}/{repo_slug}/hooks/{uid}
PUT /repositories/{workspace}/{repo_slug}/hooks/{uid}

Updates the specified webhook subscription.

The following properties can be mutated:

  • description
  • url
  • secret
  • active
  • events

The hook’s secret is used as a key to generate the HMAC hex digest sent in the
X-Hub-Signature header at delivery time. This signature is only generated
when the hook has a secret.

Set the hook’s secret by passing the new value in the secret field. Passing a
null value in the secret field will remove the secret from the hook. The
hook’s secret can be left unchanged by not passing the secret field in the
request.

operationId: Repositories_updateWebhookSubscription

Parameters

Name In Required Type Description
repo_slug path required string

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

uid path required string

Installed webhook’s ID

workspace path required string

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

Responses

200

The webhook subscription object.

403

If the authenticated user does not have permission to update the webhook.

404

If the webhook or repository does not exist.

PUT /repositories/{workspace}/{repo_slug}/hooks/{uid}
GET /repositories/{workspace}/{repo_slug}/override-settings
operationId: Repositories_inheritanceStateGet

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

The repository setting inheritance state

404

If no repository exists at this location

GET /repositories/{workspace}/{repo_slug}/override-settings
PUT /repositories/{workspace}/{repo_slug}/override-settings
operationId: Repositories_setInheritanceState

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

204

The repository setting inheritance state was set and no content returned

404

If no repository exists at this location

PUT /repositories/{workspace}/{repo_slug}/override-settings
GET /repositories/{workspace}/{repo_slug}/permissions-config/groups

Returns a paginated list of explicit group permissions for the given repository.
This endpoint does not support BBQL features.

operationId: Repositories_listGroupPermissions

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

Paginated of explicit group permissions on the repository.

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository.

404

One or both of the workspace and repository doesn’t exist for the given identifiers.

GET /repositories/{workspace}/{repo_slug}/permissions-config/groups
DELETE /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}

Deletes 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.

operationId: Repositories_deleteGroupPermission

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

repo_slug path required string

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

workspace path required string

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

Responses

204

Group permission deleted

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository, or the authentication method was not via app password.

404

The workspace does not exist, the repository does not exist, or the group does not exist.

DELETE /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}
GET /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}

Returns 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:

  • admin
  • write
  • read
  • none
operationId: Repositories_getGroupPermissions

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

repo_slug path required string

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

workspace path required string

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

Responses

200

Group permission for group slug and repository

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository.

404

The given user, workspace, and/or repository could not be found

GET /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}
PUT /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}

Updates the group permission, or grants a new permission if one does not already exist.

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:

  • admin
  • write
  • read
operationId: Repositories_updateGroupPermission

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

repo_slug path required string

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

workspace path required string

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

Request Body

The permission to grant

application/json
schema bitbucket.apps.permissions.serializers.RepoPermissionUpdateSchema
Property Type Required
permission string required

Responses

200

Group permission updated

400

No permission value was provided or the value is invalid(not one of read, write, or admin)

401

The user couldn’t be authenticated.

402

You have reached your plan’s user limit and must upgrade before giving access to additional users.

403

The requesting user isn’t an admin of the repository, or the authentication method was not via app password.

404

The workspace does not exist, the repository does not exist, or the group does not exist.

PUT /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}
GET /repositories/{workspace}/{repo_slug}/permissions-config/users

Returns a paginated list of explicit user permissions for the given repository.
This endpoint does not support BBQL features.

operationId: Repositories_listUserPermissions

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

Paginated of explicit user permissions on the repository.

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository.

404

No repository exists for the given repository slug and workspace.

GET /repositories/{workspace}/{repo_slug}/permissions-config/users
DELETE /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}

Deletes 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.

operationId: Repositories_deleteUserPermission

Parameters

Name In Required Type Description
repo_slug path required string

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

selected_user_id path required string

This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}, OR an Atlassian Account ID.

workspace path required string

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

Responses

204

The repository user permission was deleted and no content returned.

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository, or the authentication method was not via app password.

404

One or more of the workspace, repository, and user doesn’t exist for the given identifiers.

DELETE /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}
GET /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}

Returns 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:

  • admin
  • write
  • read
  • none
operationId: Repositories_explicitUserPermission

Parameters

Name In Required Type Description
repo_slug path required string

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

selected_user_id path required string

This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}, OR an Atlassian Account ID.

workspace path required string

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

Responses

200

Explicit user permission for user and repository

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the repository.

404

One or both of the workspace and repository doesn’t exist for the given identifiers.

GET /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}
PUT /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}

Updates 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:

  • admin
  • write
  • read
operationId: Repositories_updateUserPermission

Parameters

Name In Required Type Description
repo_slug path required string

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

selected_user_id path required string

This can either be the UUID of the account, surrounded by curly-braces, for
example: {account UUID}, OR an Atlassian Account ID.

workspace path required string

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

Request Body

The permission to grant

application/json
schema bitbucket.apps.permissions.serializers.RepoPermissionUpdateSchema
Property Type Required
permission string required

Responses

200

Explicit user permission updated

400

No permission value was provided or the value is invalid (not one of read, write, or admin), or the selected user is not a valid user to update.

401

The user couldn’t be authenticated.

402

You have reached your plan’s user limit and must upgrade before giving access to additional users.

403

The requesting user isn’t an admin of the repository, or the authentication method was not via app password.

404

One or more of the workspace, repository, and selected user doesn’t exist for the given identifiers.

PUT /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id}
GET /repositories/{workspace}/{repo_slug}/watchers

Returns a paginated list of all the watchers on the specified
repository.

operationId: Repositories_listWatchers

Parameters

Name In Required Type Description
repo_slug path required string

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

workspace path required string

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

Responses

200

A paginated list of all the watchers on the specified repository.

GET /repositories/{workspace}/{repo_slug}/watchers
Load more endpoints