Project statistics API

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Use this API to retrieve statistics about a project. All endpoints require authentication.

You must have read access to the repository. Personal access tokens must have the read_api scope. Group access tokens can use the Reporter role and the read_api scope.

This API retrieves the number of times the project is either cloned or pulled with the HTTP method. SSH fetches are not included.

Get the statistics of the last 30 days

Get the clone and pull statistics for a project for the last 30 days.

GET /projects/:id/statistics

Supported attributes:

AttributeTypeRequiredDescription
idinteger or stringYesID or URL-encoded path of the project.

If successful, returns 200 OK and the following response attributes:

AttributeTypeDescription
fetchesobjectFetch statistics for the project.
fetches.daysarrayArray of daily fetch statistics.
fetches.days[].countintegerNumber of fetches for the specific date.
fetches.days[].datestringDate in ISO format (YYYY-MM-DD).
fetches.totalintegerTotal number of fetches for the last 30 days.

Example request:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/42/statistics"

Example response:

{
  "fetches": {
    "total": 50,
    "days": [
      {
        "count": 10,
        "date": "2018-01-10"
      },
      {
        "count": 10,
        "date": "2018-01-09"
      },
      {
        "count": 10,
        "date": "2018-01-08"
      },
      {
        "count": 10,
        "date": "2018-01-07"
      },
      {
        "count": 10,
        "date": "2018-01-06"
      }
    ]
  }
}