Skip to content

Download count statistics

GET /api/v5/repos/{owner}/{repo}/download_statistics

Queries the download counts of the specified repository within a date range. You can set the start and end dates and the sort order; the response returns daily download details, the total downloads in the period, and the historical cumulative downloads.

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)
start_date query string No Statistics start date, inclusive (such as 2024-01-06)
end_date query string No Statistics end date, inclusive (such as 2024-12-06)
direction query string No Sort order: ascending asc, descending desc; default desc

Response parameters

Field Type Always returned Nullable Description
download_statistics_detail object[] Yes No List of download count details
download_statistics_total integer Yes No Total downloads in the statistics period
download_statistics_history_total integer Yes No Historical cumulative downloads

download_statistics_detail object

Field Type Always returned Nullable Description
download_statistics_detail.pdate string Yes No Statistics date (such as 2024-11-13)
download_statistics_detail.repo_id string Yes No Repository ID
download_statistics_detail.today_dl_cnt integer Yes No Downloads on that day
download_statistics_detail.total_dl_cnt integer Yes No Cumulative downloads up to that date

Error response

This endpoint has no business-level error response.

HTTP status codes

Status code Description
200 Success (OK)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Request path does not exist

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 <start_date> with the statistics start date (such as 2024-01-06); replace <end_date> with the statistics end date (such as 2024-12-06). This endpoint allows anonymous access and needs no credentials; you can also send an AtomGit user access token (access_token) to access repositories that require authorization.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/download_statistics?start_date=2024-01-06&end_date=2024-12-06&direction=desc' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/download_statistics?start_date=2024-01-06&end_date=2024-12-06&direction=desc",
  {
    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>/download_statistics",
    params={
        "start_date": "2024-01-06",
        "end_date": "2024-12-06",
        "direction": "desc",
    },
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "download_statistics_detail": [
    {
      "pdate": "2024-11-13",
      "repo_id": "625513",
      "today_dl_cnt": 0,
      "total_dl_cnt": 38
    },
    {
      "pdate": "2024-11-16",
      "repo_id": "625513",
      "today_dl_cnt": 5,
      "total_dl_cnt": 43
    }
  ],
  "download_statistics_total": 7,
  "download_statistics_history_total": 45
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
403 Access forbidden
404 Request path does not exist
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc