{"meta":{"title":"Points de terminaison d’API REST pour les statistiques de dépôt","intro":"Utilisez l’API REST pour récupérer les données que GitHub utilise pour visualiser différents types d’activités de dépôt.","product":"API REST","breadcrumbs":[{"href":"/fr/enterprise-cloud@latest/rest","title":"API REST"},{"href":"/fr/enterprise-cloud@latest/rest/metrics","title":"Mesures"},{"href":"/fr/enterprise-cloud@latest/rest/metrics/statistics","title":"Statistiques"}],"documentType":"article"},"body":"# Points de terminaison d’API REST pour les statistiques de dépôt\n\nUtilisez l’API REST pour récupérer les données que GitHub utilise pour visualiser différents types d’activités de dépôt.\n\n## À propos des statistiques de dépôt\n\nVous pouvez utiliser l’API REST pour récupérer les données que GitHub utilise pour visualiser différents types d’activités de dépôt.\n\n### Bonnes pratiques pour la mise en cache\n\nLe calcul des statistiques de dépôt est une opération coûteuse. Nous essayons donc de retourner les données mises en cache chaque fois que nous le pouvons. Si les données n’ont pas été mises en cache lorsque vous interrogez les statistiques d’un dépôt, vous recevrez une réponse `202`. Un travail en arrière-plan sera également déclenché pour commencer la compilation de ces statistiques. Vous devez laisser à la tâche un peu de temps pour se terminer, puis soumettre de nouveau la demande. Si le travail est terminé, cette demande recevra une réponse `200` dont le corps contiendra les statistiques.\n\nLes statistiques de dépôt sont mises en cache par le SHA de la branche par défaut du dépôt. Si vous poussez les données vers la branche par défaut, cela réinitialisera le cache des statistiques.\n\n### Les statistiques excluent certains types de commits\n\nLes statistiques exposées par l’API correspondent aux statistiques qui apparaissent dans [différents graphes de dépôt](/fr/enterprise-cloud@latest/repositories/viewing-activity-and-data-for-your-repository/about-repository-graphs).\n\nEn résumé :\n\n* Toutes les statistiques excluent les commits de fusion.\n* Les statistiques de contributeur excluent également les commits vides.\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## Get the weekly commit activity\n\n```\nGET /repos/{owner}/{repo}/stats/code_frequency\n```\n\nReturns a weekly aggregate of the number of additions and deletions pushed to a repository.\nNote\n\nThis endpoint can only be used for repositories with fewer than 10,000 commits. If the repository contains 10,000 or more commits, a 422 status code will be returned.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - Returns a weekly aggregate of the number of additions and deletions pushed to a repository.\n\n* **202** - Accepted\n\n* **204** - A header with no content is returned.\n\n* **422** - Repository contains more than 10,000 commits\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/stats/code_frequency\n```\n\n**Response schema (Status: 200):**\n\nArray of array\n\n## Get the last year of commit activity\n\n```\nGET /repos/{owner}/{repo}/stats/commit_activity\n```\n\nReturns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **202** - Accepted\n\n* **204** - A header with no content is returned.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/stats/commit_activity\n```\n\n**Response schema (Status: 200):**\n\nArray of `Commit Activity`:\n\n* `days`: required, array of integer\n* `total`: required, integer\n* `week`: required, integer\n\n## Get all contributor commit activity\n\n```\nGET /repos/{owner}/{repo}/stats/contributors\n```\n\nReturns the total number of commits authored by the contributor. In addition, the response includes a Weekly Hash (weeks array) with the following information:\n\nw - Start of the week, given as a Unix timestamp.\na - Number of additions\nd - Number of deletions\nc - Number of commits\n\nNote\n\nThis endpoint will return 0 values for all addition and deletion counts in repositories with 10,000 or more commits.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **202** - Accepted\n\n* **204** - A header with no content is returned.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/stats/contributors\n```\n\n**Response schema (Status: 200):**\n\nArray of `Contributor Activity`:\n\n* `author`: required, any of:\n  * **null**\n  * **Simple User**\n    * `name`: string or null\n    * `email`: string or null\n    * `login`: required, string\n    * `id`: required, integer, format: int64\n    * `node_id`: required, string\n    * `avatar_url`: required, string, format: uri\n    * `gravatar_id`: required, string or null\n    * `url`: required, string, format: uri\n    * `html_url`: required, string, format: uri\n    * `followers_url`: required, string, format: uri\n    * `following_url`: required, string\n    * `gists_url`: required, string\n    * `starred_url`: required, string\n    * `subscriptions_url`: required, string, format: uri\n    * `organizations_url`: required, string, format: uri\n    * `repos_url`: required, string, format: uri\n    * `events_url`: required, string\n    * `received_events_url`: required, string, format: uri\n    * `type`: required, string\n    * `site_admin`: required, boolean\n    * `starred_at`: string\n    * `user_view_type`: string\n* `total`: required, integer\n* `weeks`: required, array of objects:\n  * `w`: integer\n  * `a`: integer\n  * `d`: integer\n  * `c`: integer\n\n## Get the weekly commit count\n\n```\nGET /repos/{owner}/{repo}/stats/participation\n```\n\nReturns the total commit counts for the owner and total commit counts in all. all is everyone combined, including the owner in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract owner from all.\nThe array order is oldest week (index 0) to most recent week.\nThe most recent week is seven days ago at UTC midnight to today at UTC midnight.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - The array order is oldest week (index 0) to most recent week.\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/stats/participation\n```\n\n**Response schema (Status: 200):**\n\n* `all`: required, array of integer\n* `owner`: required, array of integer\n\n## Get the hourly commit count for each day\n\n```\nGET /repos/{owner}/{repo}/stats/punch_card\n```\n\nEach array contains the day number, hour number, and number of commits:\n\n0-6: Sunday - Saturday\n0-23: Hour of day\nNumber of commits\n\nFor example, \\[2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - For example, \\[2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.\n\n* **204** - A header with no content is returned.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/stats/punch_card\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get the weekly commit activity](#get-the-weekly-commit-activity)."}