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

Rate this page:

Commits

These are the repository's commits. They are paginated and returned in reverse chronological order, similar to the output of git log.

Get a commit

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

Returns the specified commit.

Example:

1
2
$ curl https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a1
{
    "rendered": {
        "message": {
        "raw": "Add a GEORDI_OUTPUT_DIR setting",
        "markup": "markdown",
        "html": "<p>Add a GEORDI_OUTPUT_DIR setting</p>",
        "type": "rendered"
        }
    },
    "hash": "f7591a13eda445d9a9167f98eb870319f4b6c2d8",
    "repository": {
        "name": "geordi",
        "type": "repository",
        "full_name": "bitbucket/geordi",
        "links": {
            "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi"
            },
            "html": {
                "href": "https://bitbucket.org/bitbucket/geordi"
            },
            "avatar": {
                "href": "https://bytebucket.org/ravatar/%7B85d08b4e-571d-44e9-a507-fa476535aa98%7D?ts=1730260"
            }
        },
        "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
    },
    "links": {
        "self": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8"
        },
        "comments": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/comments"
        },
        "patch": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/patch/f7591a13eda445d9a9167f98eb870319f4b6c2d8"
        },
        "html": {
            "href": "https://bitbucket.org/bitbucket/geordi/commits/f7591a13eda445d9a9167f98eb870319f4b6c2d8"
        },
        "diff": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/diff/f7591a13eda445d9a9167f98eb870319f4b6c2d8"
        },
        "approve": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/approve"
        },
        "statuses": {
            "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f7591a13eda445d9a9167f98eb870319f4b6c2d8/statuses"
        }
    },
    "author": {
        "raw": "Brodie Rao <a@b.c>",
        "type": "author",
        "user": {
            "display_name": "Brodie Rao",
            "uuid": "{9484702e-c663-4afd-aefb-c93a8cd31c28}",
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/users/%7B9484702e-c663-4afd-aefb-c93a8cd31c28%7D"
                },
                "html": {
                    "href": "https://bitbucket.org/%7B9484702e-c663-4afd-aefb-c93a8cd31c28%7D/"
                },
                "avatar": {
                    "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:3aae1e05-702a-41e5-81c8-f36f29afb6ca/613070db-28b0-421f-8dba-ae8a87e2a5c7/128"
                }
            },
            "type": "user",
            "nickname": "brodie",
            "account_id": "557058:3aae1e05-702a-41e5-81c8-f36f29afb6ca"
        }
    },
    "summary": {
        "raw": "Add a GEORDI_OUTPUT_DIR setting",
        "markup": "markdown",
        "html": "<p>Add a GEORDI_OUTPUT_DIR setting</p>",
        "type": "rendered"
    },
    "participants": [],
    "parents": [
        {
            "type": "commit",
            "hash": "f06941fec4ef6bcb0c2456927a0cf258fa4f899b",
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/repositories/bitbucket/geordi/commit/f06941fec4ef6bcb0c2456927a0cf258fa4f899b"
                },
                "html": {
                    "href": "https://bitbucket.org/bitbucket/geordi/commits/f06941fec4ef6bcb0c2456927a0cf258fa4f899b"
                }
            }
        }
    ],
    "date": "2012-07-16T19:37:54+00:00",
    "message": "Add a GEORDI_OUTPUT_DIR setting",
    "type": "commit"
}
repository

Request

Path parameters
commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Example

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'

Responses

The commit object

Content typeValue
application/json

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

Approve a commit

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

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

repository:write

Request

Path parameters
commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Example

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'

Responses

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

Content typeValue
application/json

allOf [object, Participant]

Unapprove a commit

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

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

repository:write

Request

Path parameters
commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Example

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

Responses

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

List a commit's comments

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

Returns the commit's comments.

This includes both global and inline comments.

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

repository

Request

Path parameters
commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Query parameters
q

string

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

sort

string

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

Example

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'

Responses

A paginated list of commit comments.

Content typeValue
application/json

Paginated Commit Comments

Create comment for a commit

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

Creates new comment on the specified commit.

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

1
2
$ 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}}'
repository

Request

Path parameters
commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Body parameters
Content typeValue
application/json

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

Example

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

Responses

The newly created comment.

A schema has not been defined for this response code.

Header Parameters
Location

string

The location of the newly created comment.

Get a commit comment

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

Returns the specified commit comment.

repository

Request

Path parameters
comment_id Required

integer

The id of the comment.

commit Required

string

The commit's SHA1.

repo_slug Required

string

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

workspace Required

string

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

Example

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'

Responses