A Guide to Commits REST API in Bitbucket Cloud
For development teams seeking deeper insights into their codebase activity, commit data is essential. While ready-to-use reports with commit data can be generated in Bitbucket, teams with custom analytics dashboards might prefer tools like REST API to tailor reporting to their exact needs. This is why Awesome Graphs for Bitbucket has expanded its capabilities to now also offer the Commits REST API. In this article, we’ll show you how to leverage the Awesome Graphs API to retrieve granular commit data and statistics from Bitbucket Cloud.
Awesome Graphs is a top-rated analytics and reporting app for Bitbucket that provides teams with comprehensive insights into their projects and repositories. Beyond its ready-to-use graphs and reports, Awesome Graphs offers powerful REST API endpoints for custom data retrieval and integration.
What commit data you can access with REST API
The new Awesome Graphs Commits REST API enables you to retrieve granular metadata as well as aggregated commit statistics, including lines of code changes in your Bitbucket. Some of the valuable data you can query include:
- Lines of code statistics: added and deleted lines per commit, repository LOC statistics
- Author details: display name and unique user ID
- Commit date
- Repository information: which repository the commit belongs to
- Commit hash and parent commit hashes
This data can power various use cases, from tracking individual developer contributions to analyzing code churn patterns and identifying repositories with the most active development.
Retrieving commit data with Awesome Graphs REST API
Let’s now explore how the Commits REST API works in the Awesome Graphs app and the steps you need to follow to start using it. To access Awesome Graphs REST API, ensure the app is installed in your Bitbucket Cloud workspace and generate an API Access Token from your workspace settings.
Our API allows you to retrieve commit data at the workspace, repository, and user levels. Here is an example of a request that will fetch you all the commits made by a particular user:
curl --request GET \
--url 'https://awesome-graphs.stiltsoft.net/rest/latest/workspace/{workspaceSlug}/users/{user_uuid}/commits?since_date=2025-05-30T00:00:00Z' \
--header 'Authorization: {access_token}' \
--header 'Accept: application/json'
The API offers several useful parameters to filter and customize your results:
- order: Return commits in “newest” or “oldest” first order
- merges: Control whether to include, exclude, or only return merge commits
- since_date and until_date: Define the time range for commit retrieval
To complete your query, refer to our tutorial on retrieving the user_uuid for the user of interest.
Here’s an example response showing commit data:
{
"values": [
{
"author": {
"display_name": "John Doe",
"uuid": "{025f262e-71dc-41e5-80ba-14fd3a276373}"
},
"date": "2025-07-03T00:00:00",
"hash": "1f45adc0314f3fa0f800020ca0f8d452be696089",
"parents": [
{
"hash": "0a6036345d4b8c4d03175a24bf71ba1d46bd6aad"
}
],
"repository": {
"slug": "my-repo"
}
}
],
"page": 2,
"pagelen": 10,
"previous": "https://awesome-graphs.stiltsoft.net/rest/latest/workspace/my-workspace/users/{user_uuid}/commits?page=1&pagelen=10",
"next": "https://awesome-graphs.stiltsoft.net/rest/latest/workspace/my-workspace/users/{user_uuid}/commits?page=3&pagelen=10"
}
On the repository level, there is an additional parameter available: with_lines includes lines of code information in a query output. It is important to note that in order to access lines of code data, you need to enable lines of code indexing for your repositories in the Awesome Graphs settings.
Here is what the output with lines of code can look like:
{
"values": [
{
"author": {
"display_name": "John Doe",
"uuid": "{025f262e-71dc-41e5-80ba-14fd3a276373}"
},
"date": "2025-07-03T00:00:00",
"hash": "1f45adc0314f3fa0f800020ca0f8d452be696089",
"lines": {
"added": 42,
"deleted": 7
},
"parents": [
{
"hash": "0a6036345d4b8c4d03175a24bf71ba1d46bd6aad"
}
],
"repository": {
"slug": "my-repo"
}
}
],
"page": 2,
"pagelen": 10,
"previous": "https://awesome-graphs.stiltsoft.net/rest/latest/workspace/my-workspace/repos/awesome-repo/commits?page=1&pagelen=10",
"next": "https://awesome-graphs.stiltsoft.net/rest/latest/workspace/my-workspace/repos/awesome-repo/commits?page=3&pagelen=10"
}
Repository commit and lines of code statistics
Beyond individual commit data, the Commits API provides powerful statistical aggregations. The statistics endpoint returns comprehensive metrics about commit activity and code changes in your repositories.
To retrieve statistics for a specific repository, use the following query:
curl --request GET \
--url 'https://awesome-graphs.stiltsoft.net/rest/latest/workspace/{workspaceSlug}/repos/{repositorySlug}/changes-statistics' \
--header 'Authorization: {access_token}' \
--header 'Accept: application/json'
The statistics response includes detailed percentile distributions that help you understand typical lines of code patterns:
{
"commits": 2,
"lines_of_code": {
"added": {
"average": 17,
"median": 17,
"p75": 24,
"p95": 30,
"p99": 32,
"total": 34
},
"changed": {
"average": 28,
"median": 28,
"p75": 38,
"p95": 45,
"p99": 47,
"total": 56
},
"deleted": {
"average": 11,
"median": 11,
"p75": 13,
"p95": 15,
"p99": 15,
"total": 22
}
}
}
The output includes both added and deleted lines, giving you a complete picture of code churn.
Practical use cases for the Commits REST API
The flexibility of the Awesome Graphs Commits REST API opens up numerous possibilities for custom integrations and analytics:
- Custom dashboards: Build internal dashboards that combine commit data with other metrics from your development stack. Track commit frequency, code change volume, and developer contributions in real-time visualizations tailored to your team’s needs.
- Automated reporting: Set up scheduled scripts that pull commit statistics and generate regular reports for stakeholders. Automate the tracking of sprint-level or monthly commit activity without manual data collection.
- Integration with analytics platforms: Export commit data to business intelligence tools or custom databases for deeper analysis. Combine Bitbucket commit information with data from other sources to gain comprehensive insights into your development process.
- Developer productivity tracking: Monitor individual and team-level commit patterns to understand workload distribution and identify opportunities for process improvements. Track trends over time to measure the impact of changes to your development workflow.
If you are interested in also retrieving pull request data with REST API, refer to our article on Awesome Graphs Pull Request endpoints.
Getting started with Awesome Graphs Commits REST API
To try Awesome Graphs Commits REST API in your Bitbucket:
- Install Awesome Graphs in your Bitbucket Cloud workspace: a free 14-day trial will start automatically.
- Generate an API Access Token in the Awesome Graphs section of your workspace settings.
- Enable lines of code indexing for repositories where you want detailed statistics.
- Consult the Awesome Graphs REST API documentation to create your target query.
If you have questions about the Commits REST API or need assistance with implementation, reach out to our customer support portal. Our team is here to help you make the most of your Bitbucket data.
➡️ Explore more about Bitbucket analytics and reporting capabilities in Awesome Graphs.