Get repository contributor statistics¶
GET /api/v5/repos/{owner}/{repo}/contributors/statistic
Retrieves contributor statistics of the specified repository, returning each contributor's added lines, deleted lines, total changes, and commit counts, along with contribution details broken down by date. You can filter by contributor, date range, and branch.
Supported access tokens¶
- AtomGit user access tokens
Anonymous access allowed¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace address to which the repository belongs (address path of the enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
author |
query | string | No | Username to filter contributors by. Specify a username to get that user's contribution data. By default, contribution data for all users is returned |
current_user |
query | boolean | No | Whether to return only the current user's data. true returns only the current user's contribution data; false or omitted returns all users' contribution data. When true, it takes precedence over author. Default false |
since |
query | string | No | Start date in YYYY-MM-DD or YYYY-MM-DD HH:mm:ss format, limiting the start of the returned contribution data |
until |
query | string | No | End date in YYYY-MM-DD or YYYY-MM-DD HH:mm:ss format, limiting the end of the returned contribution data |
ref_name |
query | string | No | ref_name to get contribution data for (branch name, commit ID, tag name); when omitted or empty, the default branch is used |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
name |
string | Yes | No | Contributor username |
email |
string | Yes | No | Contributor email |
overview |
object | Yes | No | Summary statistics of the contributor |
contributions |
array | Yes | No | Contribution details broken down by date |
overview object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
overview.additions |
integer | Yes | No | Added lines |
overview.deletions |
integer | Yes | No | Deleted lines |
overview.total_changes |
integer | Yes | No | Total changes |
overview.commit_count |
integer | Yes | No | Number of commits |
contributions[] object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
contributions.date |
string | Yes | No | Contribution date |
contributions.additions |
integer | Yes | No | Lines added that day |
contributions.deletions |
integer | Yes | No | Lines deleted that day |
contributions.total_changes |
integer | Yes | No | Total changes that day |
contributions.commit_count |
integer | Yes | No | Number of commits that day |
Error response¶
A
200success response alone is not enough: callers need to know what a failure looks like in order to write error handling.
400 Invalid parameters
{
"error": "invalid_request",
"message": "Incorrect parameter format or a required parameter is missing"
}
404 Resource does not exist
The specific error field names follow what the backend actually returns.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Resource does not exist (Not found) |
Request example¶
Parameter notes¶
Replace
<owner>with the namespace address to which the repository belongs (address path of the enterprise, organization, or user); replace<repo>with the repository path (path); replace<token>with your AtomGit user access token (optional; it may be omitted for anonymous access, or you can send a token).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/contributors/statistic?author=<username>&since=2024-01-01&until=2024-12-31¤t_user=false' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/contributors/statistic?author=<username>&since=2024-01-01&until=2024-12-31",
{
headers: {
"Accept": "application/json",
},
},
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/contributors/statistic",
params={
"author": "<username>",
"since": "2024-01-01",
"until": "2024-12-31",
},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"name": "test",
"email": "aa@ss.com",
"overview": {
"additions": 762,
"deletions": 0,
"total_changes": 762,
"commit_count": 8
},
"contributions": [
{
"date": "2024-12-05",
"additions": 759,
"deletions": 0,
"total_changes": 759,
"commit_count": 5
},
{
"date": "2024-12-08",
"additions": 2,
"deletions": 0,
"total_changes": 2,
"commit_count": 2
},
{
"date": "2024-12-09",
"additions": 1,
"deletions": 0,
"total_changes": 1,
"commit_count": 1
}
]
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
400 |
Invalid parameters or the request cannot be parsed |
404 |
Request path does not exist |
405 |
Request method not supported |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc