Find list of changed files within a Pull Request
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
In a given scenario, a user may want to know the size of the changed files within a Pull Request
This information can be used to decide if they want to run a pipeline to that Pull Request.
Environment
Bitbucket Cloud.
Solution
It is possible to retrieve the list of changed files from the API with the following steps:
Make an API call to GET a Pull Request endpoint. Example:
curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'On the payload, you will find the link for the diffstat (links.diffstat.href)
Perform a GET request, using Curl for example, to the diffstat URL retrieved. Example:
curl -u <atlassian_account_email>:<api_token> "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/diffstat/{workspace}/{repo_slug}:{diffstat_hash}?from_pullrequest_id={pull_request_id}&topic=true"
where <atlassian_account_email> is your Atlassian account email and <api_token> is an API token for that account.
Updated on September 26, 2025
Was this helpful?
Still need help?
The Atlassian Community is here for you.