{"meta":{"title":"Конечные точки REST API для трафика репозитория","intro":"Используйте REST API для получения сведений, предоставленных в граф репозитория.","product":"REST API","breadcrumbs":[{"href":"/ru/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/ru/enterprise-cloud@latest/rest/metrics","title":"Метрики"},{"href":"/ru/enterprise-cloud@latest/rest/metrics/traffic","title":"Трафик"}],"documentType":"article"},"body":"# Конечные точки REST API для трафика репозитория\n\nИспользуйте REST API для получения сведений, предоставленных в граф репозитория.\n\n## Сведения о трафике репозитория\n\nЭти конечные точки можно использовать для получения сведений, предоставленных в граф репозитория, для репозиториев, к которым у вас есть доступ на запись. Дополнительные сведения см. в разделе [Просмотр трафика в репозиторий](/ru/enterprise-cloud@latest/repositories/viewing-activity-and-data-for-your-repository/viewing-traffic-to-a-repository).\n\n> \\[!NOTE]\n> Статистика трафика репозитория недоступна через REST API или интерфейс GHE.com.\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 repository clones\n\n```\nGET /repos/{owner}/{repo}/traffic/clones\n```\n\nGet 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.\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* **`per`** (string)\n  The time frame to display results for.\n  Default: `day`\n  Can be one of: `day`, `week`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\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/traffic/clones\n```\n\n**Response schema (Status: 200):**\n\n* `count`: required, integer\n* `uniques`: required, integer\n* `clones`: required, array of `Traffic`:\n  * `timestamp`: required, string, format: date-time\n  * `uniques`: required, integer\n  * `count`: required, integer\n\n## Get top referral paths\n\n```\nGET /repos/{owner}/{repo}/traffic/popular/paths\n```\n\nGet the top 10 popular contents over the last 14 days.\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* **403** - Forbidden\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/traffic/popular/paths\n```\n\n**Response schema (Status: 200):**\n\nArray of `Content Traffic`:\n\n* `path`: required, string\n* `title`: required, string\n* `count`: required, integer\n* `uniques`: required, integer\n\n## Get top referral sources\n\n```\nGET /repos/{owner}/{repo}/traffic/popular/referrers\n```\n\nGet the top 10 referrers over the last 14 days.\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* **403** - Forbidden\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/traffic/popular/referrers\n```\n\n**Response schema (Status: 200):**\n\nArray of `Referrer Traffic`:\n\n* `referrer`: required, string\n* `count`: required, integer\n* `uniques`: required, integer\n\n## Get page views\n\n```\nGET /repos/{owner}/{repo}/traffic/views\n```\n\nGet the total number of views 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.\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* **`per`** (string)\n  The time frame to display results for.\n  Default: `day`\n  Can be one of: `day`, `week`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\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/traffic/views\n```\n\n**Response schema (Status: 200):**\n\n* `count`: required, integer\n* `uniques`: required, integer\n* `views`: required, array of `Traffic`:\n  * `timestamp`: required, string, format: date-time\n  * `uniques`: required, integer\n  * `count`: required, integer"}