---
title: "Compare two commit diff stats"
method: GET
path: "/repositories/{workspace}/{repo_slug}/diffstat/{spec}"
tags: ["Commits"]
---

# Compare two commit diff stats

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

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

#### Single commit spec

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

#### Two commit spec

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

The two commits are interpreted as follows:

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

## Response `200`

The diff stats

- PaginatedDiffstats — A paginated list of diffstats.
  - `size` integer — Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.
  - `page` integer — Page number of the current results. This is an optional element that is not provided in all responses.
  - `pagelen` integer — Current number of objects on the existing page. The default value is 500 with 5000 being the maximum allowed value.
  - `next` string, uri — Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.
  - `previous` string, uri — Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.
  - `values` Diffstat[]
    - `type` string, required
    - `status` 'added' | 'removed' | 'modified' | 'renamed'
    - `lines_added` integer
    - `lines_removed` integer
    - `old` CommitFile — A file object, representing a file at a commit in a repository
      - `type` string, required
      - `path` string — The path in the repository
      - `commit` Commit — A repository commit object.
        - `type` string, required
        - `hash` string
        - `date` string, date-time
        - `author` Author — The author of a change in a repository
          - `type` string, required
          - `raw` string — The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket.
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
        - `committer` Committer — The committer of a change in a repository
          - `type` string, required
          - `raw` string — The raw committer value from the repository. This may be the only value available if the committer does not match a user in Bitbucket.
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
        - `message` string
        - `summary` object
          - `raw` string — The text as it was typed by a user.
          - `markup` 'markdown' | 'creole' | 'plaintext' — The type of markup language the raw content is to be interpreted in.
          - `html` string — The user's content rendered as HTML.
        - `parents` BaseCommit[]
          - `type` string, required
          - `hash` string
          - `date` string, date-time
          - `author` Author — The author of a change in a repository
            - `type` string, required
            - `raw` string — The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket.
            - `user` Account — An account object.
              - …
          - `committer` Committer — The committer of a change in a repository
            - `type` string, required
            - `raw` string — The raw committer value from the repository. This may be the only value available if the committer does not match a user in Bitbucket.
            - `user` Account — An account object.
              - …
          - `message` string
          - `summary` object
            - `raw` string — The text as it was typed by a user.
            - `markup` 'markdown' | 'creole' | 'plaintext' — The type of markup language the raw content is to be interpreted in.
            - `html` string — The user's content rendered as HTML.
          - `parents` BaseCommit[]
        - `repository` Repository — A Bitbucket repository.
          - `type` string, required
          - `links` object
            - `self` object — A link to a resource related to this object.
              - …
            - `html` object — A link to a resource related to this object.
              - …
            - `avatar` object — A link to a resource related to this object.
              - …
            - `pullrequests` object — A link to a resource related to this object.
              - …
            - `commits` object — A link to a resource related to this object.
              - …
            - `forks` object — A link to a resource related to this object.
              - …
            - `watchers` object — A link to a resource related to this object.
              - …
            - `downloads` object — A link to a resource related to this object.
              - …
            - `clone` object[]
              - …
            - `hooks` object — A link to a resource related to this object.
              - …
          - `uuid` string — The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.
          - `full_name` string — The concatenation of the repository owner's username and the slugified name, e.g. "evzijst/interruptingcow". This is the same string used in Bitbucket URLs.
          - `is_private` boolean
          - `parent` Repository — recursive
          - `scm` 'git'
          - `owner` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
          - `name` string
          - `description` string
          - `created_on` string, date-time
          - `updated_on` string, date-time
          - `size` integer
          - `language` string
          - `has_issues` boolean — The issue tracker for this repository is enabled. Issue Tracker features are not supported for repositories in workspaces administered through admin.atlassian.com.
          - `has_wiki` boolean — The wiki for this repository is enabled. Wiki features are not supported for repositories in workspaces administered through admin.atlassian.com.
          - `fork_policy` 'allow_forks' | 'no_public_forks' | 'no_forks' — Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking
          - `project` Project — A Bitbucket project. Projects are used by teams to organize repositories.
            - `type` string, required
            - `links` object
              - …
            - `uuid` string — The project's immutable id.
            - `key` string — The project's key.
            - `owner` Team — A team object.
              - …
            - `name` string — The name of the project.
            - `description` string
            - `is_private` boolean — Indicates whether the project is publicly accessible, or whether it is private to the team and consequently only visible to team members. Note that private projects cannot contain public repositories.
            - `created_on` string, date-time
            - `updated_on` string, date-time
            - `has_publicly_visible_repos` boolean — Indicates whether the project contains publicly visible repositories. Note that private projects cannot contain public repositories.
          - `mainbranch` Branch — A branch object, representing a branch in a repository.
            - `type` string, required
            - `links` object
              - …
            - `name` string — The name of the ref.
            - `target` Commit — recursive
            - `merge_strategies` string[] — Available merge strategies for pull requests targeting this branch.
            - `default_merge_strategy` string — The default merge strategy for pull requests targeting this branch.
        - `participants` Participant[]
          - `type` string, required
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
          - `role` 'PARTICIPANT' | 'REVIEWER'
          - `approved` boolean
          - `state` string
          - `participated_on` string, date-time — The ISO8601 timestamp of the participant's action. For approvers, this is the time of their approval. For commenters and pull request reviewers who are not approvers, this is the time they last commented, or null if they have not commented.
      - `attributes` 'link' | 'executable' | 'subrepository' | 'binary' | 'lfs'
      - `escaped_path` string — The escaped version of the path as it appears in a diff. If the path does not require escaping this will be the same as path.
    - `new` CommitFile — A file object, representing a file at a commit in a repository
      - `type` string, required
      - `path` string — The path in the repository
      - `commit` Commit — A repository commit object.
        - `type` string, required
        - `hash` string
        - `date` string, date-time
        - `author` Author — The author of a change in a repository
          - `type` string, required
          - `raw` string — The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket.
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
        - `committer` Committer — The committer of a change in a repository
          - `type` string, required
          - `raw` string — The raw committer value from the repository. This may be the only value available if the committer does not match a user in Bitbucket.
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
        - `message` string
        - `summary` object
          - `raw` string — The text as it was typed by a user.
          - `markup` 'markdown' | 'creole' | 'plaintext' — The type of markup language the raw content is to be interpreted in.
          - `html` string — The user's content rendered as HTML.
        - `parents` BaseCommit[]
          - `type` string, required
          - `hash` string
          - `date` string, date-time
          - `author` Author — The author of a change in a repository
            - `type` string, required
            - `raw` string — The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket.
            - `user` Account — An account object.
              - …
          - `committer` Committer — The committer of a change in a repository
            - `type` string, required
            - `raw` string — The raw committer value from the repository. This may be the only value available if the committer does not match a user in Bitbucket.
            - `user` Account — An account object.
              - …
          - `message` string
          - `summary` object
            - `raw` string — The text as it was typed by a user.
            - `markup` 'markdown' | 'creole' | 'plaintext' — The type of markup language the raw content is to be interpreted in.
            - `html` string — The user's content rendered as HTML.
          - `parents` BaseCommit[]
        - `repository` Repository — A Bitbucket repository.
          - `type` string, required
          - `links` object
            - `self` object — A link to a resource related to this object.
              - …
            - `html` object — A link to a resource related to this object.
              - …
            - `avatar` object — A link to a resource related to this object.
              - …
            - `pullrequests` object — A link to a resource related to this object.
              - …
            - `commits` object — A link to a resource related to this object.
              - …
            - `forks` object — A link to a resource related to this object.
              - …
            - `watchers` object — A link to a resource related to this object.
              - …
            - `downloads` object — A link to a resource related to this object.
              - …
            - `clone` object[]
              - …
            - `hooks` object — A link to a resource related to this object.
              - …
          - `uuid` string — The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.
          - `full_name` string — The concatenation of the repository owner's username and the slugified name, e.g. "evzijst/interruptingcow". This is the same string used in Bitbucket URLs.
          - `is_private` boolean
          - `parent` Repository — recursive
          - `scm` 'git'
          - `owner` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
          - `name` string
          - `description` string
          - `created_on` string, date-time
          - `updated_on` string, date-time
          - `size` integer
          - `language` string
          - `has_issues` boolean — The issue tracker for this repository is enabled. Issue Tracker features are not supported for repositories in workspaces administered through admin.atlassian.com.
          - `has_wiki` boolean — The wiki for this repository is enabled. Wiki features are not supported for repositories in workspaces administered through admin.atlassian.com.
          - `fork_policy` 'allow_forks' | 'no_public_forks' | 'no_forks' — Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking
          - `project` Project — A Bitbucket project. Projects are used by teams to organize repositories.
            - `type` string, required
            - `links` object
              - …
            - `uuid` string — The project's immutable id.
            - `key` string — The project's key.
            - `owner` Team — A team object.
              - …
            - `name` string — The name of the project.
            - `description` string
            - `is_private` boolean — Indicates whether the project is publicly accessible, or whether it is private to the team and consequently only visible to team members. Note that private projects cannot contain public repositories.
            - `created_on` string, date-time
            - `updated_on` string, date-time
            - `has_publicly_visible_repos` boolean — Indicates whether the project contains publicly visible repositories. Note that private projects cannot contain public repositories.
          - `mainbranch` Branch — A branch object, representing a branch in a repository.
            - `type` string, required
            - `links` object
              - …
            - `name` string — The name of the ref.
            - `target` Commit — recursive
            - `merge_strategies` string[] — Available merge strategies for pull requests targeting this branch.
            - `default_merge_strategy` string — The default merge strategy for pull requests targeting this branch.
        - `participants` Participant[]
          - `type` string, required
          - `user` Account — An account object.
            - `type` string, required
            - `links` AccountLinks — Links related to an Account.
              - …
            - `created_on` string, date-time
            - `display_name` string
            - `uuid` string
          - `role` 'PARTICIPANT' | 'REVIEWER'
          - `approved` boolean
          - `state` string
          - `participated_on` string, date-time — The ISO8601 timestamp of the participant's action. For approvers, this is the time of their approval. For commenters and pull request reviewers who are not approvers, this is the time they last commented, or null if they have not commented.
      - `attributes` 'link' | 'executable' | 'subrepository' | 'binary' | 'lfs'
      - `escaped_path` string — The escaped version of the path as it appears in a diff. If the path does not require escaping this will be the same as path.

## Other responses

- `555` — If generating the diffstat timed out.

---

[API](https://skmtc.dev/bitbucket/apis/bitbucket-api.md) · [All operations](https://skmtc.dev/bitbucket/apis/bitbucket-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/bitbucket/bitbucket-api/revisions/a5a558b87aae/schema)
