---
title: "Get the license for a repository"
method: GET
path: "/repos/{owner}/{repo}/license"
tags: ["licenses"]
---

# Get the license for a repository

`GET /repos/{owner}/{repo}/license`

This method returns the contents of the repository's license file, if one is detected.

Similar to [Get repository content](https://docs.github.com/enterprise-server@3.7/rest/repos/contents#get-repository-content), this method also supports [custom media types](https://docs.github.com/enterprise-server@3.7/rest/overview/media-types) for retrieving the raw license content or rendered license HTML.

## Path parameters

- `owner` string, required
- `repo` string, required

## Response `200`

Response

- LicenseContent — License Content
  - `name` string, required
  - `path` string, required
  - `sha` string, required
  - `size` integer, required
  - `url` string, uri, required
  - `html_url` string, uri, nullable, required
  - `git_url` string, uri, nullable, required
  - `download_url` string, uri, nullable, required
  - `type` string, required
  - `content` string, required
  - `encoding` string, required
  - `_links` object, required
    - `git` string, uri, nullable, required
    - `html` string, uri, nullable, required
    - `self` string, uri, required
  - `license` NullableLicenseSimple, nullable, required — License Simple
    - `key` string, required
    - `name` string, required
    - `url` string, uri, nullable, required
    - `spdx_id` string, nullable, required
    - `node_id` string, required
    - `html_url` string, uri

## Other responses

- `404` — Resource not found

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-6.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-6/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-6/versions/15db3fa0759b/schema)
