Skip to main content

Get the license for a repository

This method returns the contents of the repository's license file, if one is detected. Similar to [Get repository content](https://docs.github.com/[email protected]/rest/reference/repos#get-repository-content), this method also supports [custom media types](https://docs.github.com/[email protected]/rest/overview/media-types) for retrieving the raw license content or rendered license HTML.

GET/repos/{owner}/{repo}/license
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required

Responses

application/json License Content object

Response

_links object
required
git string<uri>
requirednullable
html string<uri>
requirednullable
self string<uri>
required
content string
required
download_url string<uri>
requirednullable
encoding string
required
git_url string<uri>
requirednullable
html_url string<uri>
requirednullable
license License Simple object
requirednullable

License Simple

html_url string<uri>
optional
key string
required

Example: mit

name string
required

Example: MIT License

node_id string
required

Example: MDc6TGljZW5zZW1pdA==

spdx_id string
requirednullable

Example: MIT

url string<uri>
requirednullable

Example: https://api.github.com/licenses/mit

name string
required
path string
required
sha string
required
size integer
required
type string
required
url string<uri>
required