Skip to main content
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
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

Query parameters
Name, Type, Description
perstring

The time frame to display results for.

Default: day

Can be one of: , day, week

HTTP response status codes

Status codeDescription
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/clones

Response