The REST API is now versioned. For more information, see "About API versioning."
Repository traffic
Use the REST API to retrieve information provided in your repository graph.
About repository traffic
You can use these endpoints to retrieve information provided in your repository graph, for repositories that you have write access to. For more information, see "Viewing traffic to a repository".
Get repository clones
Works with GitHub Apps
Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
Parameters
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
ownerstringRequiredThe account owner of the repository. The name is not case sensitive. |
repostringRequiredThe name of the repository. The name is not case sensitive. |
| Query parameters |
| Name, Type, Description |
perstringThe time frame to display results for. Default: Can be one of: |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
403 | Forbidden |
Code samples
get /repos /{owner} /{repo} /traffic /clones
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/traffic/clonesResponse
Status: 200{
"