{"meta":{"title":"リポジトリ トラフィック用 REST API エンドポイント","intro":"REST API を使って、リポジトリ グラフで提供される情報を取得します。","product":"REST API","breadcrumbs":[{"href":"/ja/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/ja/enterprise-cloud@latest/rest/metrics","title":"メトリック"},{"href":"/ja/enterprise-cloud@latest/rest/metrics/traffic","title":"トラフィック"}],"documentType":"article"},"body":"# リポジトリ トラフィック用 REST API エンドポイント\n\nREST API を使って、リポジトリ グラフで提供される情報を取得します。\n\n## リポジトリ トラフィックについて\n\nこれらのエンドポイントを使って、自分が書き込みアクセス権を持つリポジトリについて、リポジトリ グラフで提供される情報を取得できます。 詳しくは、「[リポジトリへのトラフィックを表示する](/ja/enterprise-cloud@latest/repositories/viewing-activity-and-data-for-your-repository/viewing-traffic-to-a-repository)」をご覧ください。\n\nこれらのステップを実行してください：\n\n> \\[!NOTE]\n> GHE.com では、REST API または UI を通じてリポジトリのトラフィック統計が利用できません。\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"}