• Addon
  • Branch restrictions
  • Branching model
  • Commit statuses
  • Commits
  • Deployments
  • Downloads
  • Issue tracker
  • Pipelines
  • Projects
  • Pullrequests
  • Refs
  • Reports
  • Repositories
  • Snippets
  • Source
  • Ssh
  • Users
  • Webhooks
  • Workspaces
  • Other operations
Cloud
Bitbucket Cloud / Reference / REST APIs

Commits

Postman Collection
OpenAPI
GET

Get a commit

Returns the specified commit.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

commit

string

Required
repo_slug

string

Required
workspace

string

Required

Responses

The commit object

application/json

allOf [allOf [object, Base Commit], Commit]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Base Commit

The common base type for both repository and snippet commits.

Commit

A repository commit object.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 { "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" }
POST

Approve a commit

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

Scopes
repository:write
read:repository:bitbucket, write:repository:bitbucket

Request

Path parameters

commit

string

Required
repo_slug

string

Required
workspace

string

Required

Responses

The participant object recording that the authenticated user approved the commit.

application/json

allOf [object, Participant]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Participant

Object describing a user's role on resources like commits or pull requests.

POST/repositories/{workspace}/{repo_slug}/commit/{commit}/approve
1 2 3 4 curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/approve' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "type": "<string>", "user": { "type": "<string>" }, "role": "PARTICIPANT", "approved": true, "state": "approved", "participated_on": "<string>" }
DEL

Unapprove a commit

Redact the authenticated user's approval of the specified commit. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the ability to approve commits.

Scopes
repository:write
write:repository:bitbucket

Request

Path parameters

commit

string

Required
repo_slug

string

Required
workspace

string

Required

Responses

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

DEL/repositories/{workspace}/{repo_slug}/commit/{commit}/approve
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/approve' \ --header 'Authorization: Bearer <access_token>'
GET

List a commit's comments

Returns the commit's comments.

This includes both global and inline comments.

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

commit

string

Required
repo_slug

string

Required
workspace

string

Required

Query parameters

q

string

sort

string

Responses

A paginated list of commit comments.

application/json

Paginated Commit Comments

A paginated list of commit comments.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/comments
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/comments' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "commit": { "type": "<string>" } } ] }
POST

Create comment for a commit

Creates new comment on the specified commit.

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

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

Request

Path parameters

commit

string

Required
repo_slug

string

Required
workspace

string

Required

Request bodyapplication/json

The specified comment.

allOf [allOf [object, Comment], Commit Comment]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Comment

The base type for all comments. This type should be considered abstract. Each of the "commentable" resources defines its own subtypes (e.g. issue_comment).

Commit Comment

A commit comment.

Responses

The newly created comment.

Headers

Location

string

POST/repositories/{workspace}/{repo_slug}/commit/{commit}/comments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/comments' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "<string>", "id": 2154, "created_on": "<string>", "updated_on": "<string>", "content": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "user": { "type": "<string>" }, "deleted": true, "inline": { "from": 57, "to": 122, "path": "<string>" }, "links": { "self": { "href": "<string>", "name": "<string>" }, "html": { "href": "<string>", "name": "<string>" }, "code": { "href": "<string>", "name": "<string>" } }, "commit": { "type": "<string>" } }'
GET

Get a commit comment

Returns the specified commit comment.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

comment_id

integer

Required
commit

string

Required
repo_slug

string

Required
workspace

string

Required

Responses

The commit comment.

application/json

allOf [allOf [object, Comment], Commit Comment]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Comment

The base type for all comments. This type should be considered abstract. Each of the "commentable" resources defines its own subtypes (e.g. issue_comment).

Commit Comment

A commit comment.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 { "type": "<string>", "id": 2154, "created_on": "<string>", "updated_on": "<string>", "content": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "user": { "type": "<string>" }, "deleted": true, "inline": { "from": 57, "to": 122, "path": "<string>" }, "links": { "self": { "href": "<string>", "name": "<string>" }, "html": { "href": "<string>", "name": "<string>" }, "code": { "href": "<string>", "name": "<string>" } }, "commit": { "type": "<string>" } }
PUT

Update a commit comment

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

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

Request

Path parameters

comment_id

integer

Required
commit

string

Required
repo_slug

string

Required
workspace

string

Required

Request bodyapplication/json

The updated comment.

allOf [allOf [object, Comment], Commit Comment]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Comment

The base type for all comments. This type should be considered abstract. Each of the "commentable" resources defines its own subtypes (e.g. issue_comment).

Commit Comment

A commit comment.

Responses

The newly updated comment.

Headers

Location

string

PUT/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "<string>", "id": 2154, "created_on": "<string>", "updated_on": "<string>", "content": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "user": { "type": "<string>" }, "deleted": true, "inline": { "from": 57, "to": 122, "path": "<string>" }, "links": { "self": { "href": "<string>", "name": "<string>" }, "html": { "href": "<string>", "name": "<string>" }, "code": { "href": "<string>", "name": "<string>" } }, "commit": { "type": "<string>" } }'
DEL

Delete a commit comment

Deletes the specified commit comment.

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

comment_id

integer

Required
commit

string

Required
repo_slug

string

Required
workspace

string

Required

Responses

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

DEL/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/comments/{comment_id}' \ --header 'Authorization: Bearer <access_token>'
GET

List commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
workspace

string

Required

Responses

A paginated list of commits

application/json

Page

A paginated list of commits.

GET/repositories/{workspace}/{repo_slug}/commits
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commits' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "hash": "<string>", "date": "<string>", "author": { "type": "<string>" }, "message": "<string>", "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "parents": [] } ] }
POST

List commits with include/exclude

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

Note that this resource does NOT support new commit creation.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
workspace

string

Required

Responses

A paginated list of commits

application/json

Page

A paginated list of commits.

POST/repositories/{workspace}/{repo_slug}/commits
1 2 3 4 curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commits' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "hash": "<string>", "date": "<string>", "author": { "type": "<string>" }, "message": "<string>", "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "parents": [] } ] }
GET

List commits for revision

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

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

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

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

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

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

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

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

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

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

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

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
revision

string

Required
workspace

string

Required

Responses

A paginated list of commits

application/json

Page

A paginated list of commits.

GET/repositories/{workspace}/{repo_slug}/commits/{revision}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commits/{revision}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "hash": "<string>", "date": "<string>", "author": { "type": "<string>" }, "message": "<string>", "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "parents": [] } ] }
POST

List commits for revision using include/exclude

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

Note that this resource does NOT support new commit creation.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
revision

string

Required
workspace

string

Required

Responses

A paginated list of commits

application/json

Page

A paginated list of commits.

POST/repositories/{workspace}/{repo_slug}/commits/{revision}
1 2 3 4 curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commits/{revision}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "hash": "<string>", "date": "<string>", "author": { "type": "<string>" }, "message": "<string>", "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "parents": [] } ] }
GET

Compare two commits

Produces a raw git-style diff.

Single commit spec

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

Two commit spec

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

The two commits are interpreted as follows:

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

Comparison to patches

While similar to patches, diffs:

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

Response

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
spec

string

Required
workspace

string

Required

Query parameters

context

integer

path

string

ignore_whitespace

boolean

binary

boolean

renames

boolean

merge

boolean

topic

boolean

Responses

The raw diff

GET/repositories/{workspace}/{repo_slug}/diff/{spec}
1 2 3 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/diff/{spec}' \ --header 'Authorization: Bearer <access_token>'
GET

Compare two commit diff stats

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

Single commit spec

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

Two commit spec

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

The two commits are interpreted as follows:

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

Request

Path parameters

repo_slug

string

Required
spec

string

Required
workspace

string

Required

Query parameters

ignore_whitespace

boolean

merge

boolean

path

string

renames

boolean

topic

boolean

Responses

The diff stats

application/json

Paginated Diff Stat

A paginated list of diffstats.

GET/repositories/{workspace}/{repo_slug}/diffstat/{spec}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/diffstat/{spec}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 { "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 }
GET

Get the common ancestor between two commits

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

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
revspec

string

Required
workspace

string

Required

Responses

The merge base of the provided spec.

application/json

allOf [allOf [object, Base Commit], Commit]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Base Commit

The common base type for both repository and snippet commits.

Commit

A repository commit object.

GET/repositories/{workspace}/{repo_slug}/merge-base/{revspec}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-base/{revspec}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 { "type": "<string>", "hash": "<string>", "date": "<string>", "author": { "type": "<string>" }, "message": "<string>", "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "parents": [], "repository": { "type": "<string>" }, "participants": [ { "type": "<string>" } ] }
GET

Get a patch for two commits

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

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

While similar to diffs, patches:

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

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

Scopes
repository
read:repository:bitbucket

Request

Path parameters

repo_slug

string

Required
spec

string

Required
workspace

string

Required

Responses

The raw patches

GET/repositories/{workspace}/{repo_slug}/patch/{spec}
1 2 3 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/patch/{spec}' \ --header 'Authorization: Bearer <access_token>'

Rate this page: