{"meta":{"title":"ライセンス用 REST API エンドポイント","intro":"REST API を使用して、一般的なopen source ライセンスと、特定のプロジェクトのライセンス ファイルに関する情報を取得します。","product":"REST API","breadcrumbs":[{"href":"/ja/rest","title":"REST API"},{"href":"/ja/rest/licenses","title":"ライセンス"},{"href":"/ja/rest/licenses/licenses","title":"ライセンス"}],"documentType":"article"},"body":"# ライセンス用 REST API エンドポイント\n\nREST API を使用して、一般的なopen source ライセンスと、特定のプロジェクトのライセンス ファイルに関する情報を取得します。\n\n## ライセンスについて\n\nGitHub は、[ Ruby Gem Licensee](https://github.com/benbalter/licensee) open sourceを使用して、プロジェクトのライセンスの識別を試みます。 ライセンシーは、プロジェクトの `LICENSE` ファイル (存在する場合) を既知のライセンスの短いリストと照合します。 そのためライセンス API では、プロジェクト依存関係のライセンス、あるいはプロジェクトのライセンスをドキュメント化するその他の方法、たとえばドキュメントにおけるライセンス名の参照などは考慮されません。\n\nライセンスが一致した場合、返されたライセンスキーと名前は [SPDX 仕様](https://spdx.org/)に準拠します。\n\n**注釈:** 以下のエンドポイントも、リポジトリのライセンス情報を返します。\n\n* [リポジトリの取得](/ja/rest/repos/repos#get-a-repository)\n* [ユーザーのリポジトリの一覧表示](/ja/rest/repos/repos#list-repositories-for-a-user)\n* [組織リポジトリの一覧表示](/ja/rest/repos/repos#list-organization-repositories)\n* [フォークの一覧表示](/ja/rest/repos/forks#list-forks)\n* [ユーザーがウォッチしているリポジトリの一覧表示](/ja/rest/activity/watching#list-repositories-watched-by-a-user)\n* [チーム リポジトリの一覧表示](/ja/rest/teams/teams#list-team-repositories)\n\n> \\[!WARNING]\n> GitHubは多くのものですが、法律事務所ではありません。 そのため、GitHub は、法的助言を行っていません。 API を使ったり、それについてのメールを当社へ送信したりすることは、法的助言には該当せず、弁護士と依頼人の関係を確立するものでもありません。 特定のライセンスで許可される範囲について疑問がある場合は、先に進む前にそれぞれの顧問弁護士にご相談ください。 むしろ、法的な結果が想定される、あるいは法律上の権利に影響しうる決定を下す場合には、必ずその前に各自の弁護士にご相談ください。\n>\n> GitHub は、ユーザーがライセンスopen sourceおよびそれらを使用するプロジェクトに関する情報を取得できるように、これらのエンドポイントを作成しました。 お役に立てれば幸いですが、当社は (少なくとも従業員のほとんどは) 弁護士ではなく、他の方と同じように誤りがないとは言えません。 そのため、GitHub は、API を「現状のまま」提供しており、その API で、またはその API 経由で提供される情報またはライセンスに関する情報について一切保証せず、その API の使用に起因する損害についての責任も負いません。\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 all commonly used licenses\n\n```\nGET /licenses\n```\n\nLists the most commonly used licenses on GitHub. For more information, see \"Licensing a repository .\"\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* **`featured`** (boolean)\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/licenses\n```\n\n**Response schema (Status: 200):**\n\nArray of `License Simple`:\n\n* `key`: required, string\n* `name`: required, string\n* `url`: required, string or null, format: uri\n* `spdx_id`: required, string or null\n* `node_id`: required, string\n* `html_url`: string, format: uri\n\n## Get a license\n\n```\nGET /licenses/{license}\n```\n\nGets information about a specific license. For more information, see \"Licensing a repository .\"\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* **`license`** (string) (required)\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **403** - Forbidden\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/licenses/LICENSE\n```\n\n**Response schema (Status: 200):**\n\n* `key`: required, string\n* `name`: required, string\n* `spdx_id`: required, string or null\n* `url`: required, string or null, format: uri\n* `node_id`: required, string\n* `html_url`: required, string, format: uri\n* `description`: required, string\n* `implementation`: required, string\n* `permissions`: required, array of string\n* `conditions`: required, array of string\n* `limitations`: required, array of string\n* `body`: required, string\n* `featured`: required, boolean\n\n## Get the license for a repository\n\n```\nGET /repos/{owner}/{repo}/license\n```\n\nThis method returns the contents of the repository's license file, if one is detected.\nThis endpoint supports the following custom media types. For more information, see \"Media types.\"\n\napplication/vnd.github.raw+json: Returns the raw contents of the license.\napplication/vnd.github.html+json: Returns the license contents in HTML. Markup languages are rendered to HTML using GitHub's open-source Markup library.\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* **`ref`** (string)\n  The Git reference for the results you want to list. The ref for a branch can be formatted either as refs/heads/<branch name> or simply <branch name>. To reference a pull request use refs/pull/<number>/merge.\n\n### HTTP response status codes\n\n* **200** - OK\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/license\n```\n\n**Response schema (Status: 200):**\n\n* `name`: required, string\n* `path`: required, string\n* `sha`: required, string\n* `size`: required, integer\n* `url`: required, string, format: uri\n* `html_url`: required, string or null, format: uri\n* `git_url`: required, string or null, format: uri\n* `download_url`: required, string or null, format: uri\n* `type`: required, string\n* `content`: required, string\n* `encoding`: required, string\n* `_links`: required, object:\n  * `git`: required, string or null, format: uri\n  * `html`: required, string or null, format: uri\n  * `self`: required, string, format: uri\n* `license`: required, any of:\n  * **null**\n  * **License Simple**\n    * `key`: required, string\n    * `name`: required, string\n    * `url`: required, string or null, format: uri\n    * `spdx_id`: required, string or null\n    * `node_id`: required, string\n    * `html_url`: string, format: uri"}