Get the license for a repository
This method returns the contents of the repository's license file, if one is detected.
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw contents of the license.
- application/vnd.github.html+json: Returns the license contents in HTML. Markup languages are rendered to HTML using GitHub's open-source Markup library.
Request
- Base URL: https://api.github.com
- URL: https://api.github.com/repos/{owner}/{repo}/license
- Auth: none declared
Path parameters
The account owner of the repository. The name is not case sensitive.
The name of the repository without the .git extension. The name is not case sensitive.
Query parameters
The Git reference, formatted as refs/pull/<number>/merge, refs/pull/<number>/head, refs/heads/<branch name> or simply <branch name>.
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.
Response
Response
Example response
{
"license": {
"key": "mit",
"name": "MIT License",
"url": "https://api.github.com/licenses/mit",
"spdx_id": "MIT",
"node_id": "MDc6TGljZW5zZW1pdA=="
}
}Changes
No recorded changes to this operation across all 83 revisions of this API.