---
title: "Get diff statistics between two commits"
method: GET
path: "/api/v4/projects/{id}/repository/diff_stats"
tags: ["repositories"]
---

# Get diff statistics between two commits

`GET /api/v4/projects/{id}/repository/diff_stats`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/repository/diff_stats`
- Auth: none declared

Returns the number of added and deleted lines for every file that differs between two refs.

## Path parameters

- `id` string, required

## Query parameters

- `from` string, required
- `to` string, required
- `page` integer
- `per_page` integer

## Response `200`

Get diff statistics between two commits

- APIEntitiesDiffStat: API_Entities_DiffStat model
  - `path` string, required
  - `old_path` string, required
  - `additions` integer, required
  - `deletions` integer, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `429`: Too many requests

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
