Get a repository README
GET
/repos/{owner}/{repo}/readme
Gets the preferred README for a repository.
This endpoint supports the following custom media types. For more information, see “Media types.”
application/vnd.github.raw+json: Returns the raw file contents. This is the default if you do not specify a media type.application/vnd.github.html+json: Returns the README in HTML. Markup languages are rendered to HTML using GitHub’s open-source Markup library.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” owner
required
string
The account owner of the repository. The name is not case sensitive.
repo
required
string
The name of the repository without the .git extension. The name is not case sensitive.
Query Parameters
Section titled “ Query Parameters ” ref
string
The name of the commit/branch/tag. Default: the repository’s default branch.
Responses
Section titled “ Responses ”Response
Media type application/json
Content File
Content File
object
type
required
string
encoding
required
string
size
required
integer
name
required
string
path
required
string
content
required
string
sha
required
string
url
required
string format: uri
git_url
required
string format: uri
html_url
required
string format: uri
download_url
required
string format: uri
_links
required
object
git
required
string format: uri
html
required
string format: uri
self
required
string format: uri
target
string
submodule_git_url
string
Examples
Example default
{ "type": "file", "encoding": "base64", "size": 5362, "name": "README.md", "path": "README.md", "content": "encoded content ...", "sha": "3d21ec53a331a6f037a91c368710b99387d012c1", "url": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", "git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", "html_url": "https://github.com/octokit/octokit.rb/blob/master/README.md", "download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md", "_links": { "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", "self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", "html": "https://github.com/octokit/octokit.rb/blob/master/README.md" }}Not modified
Resource not found
Media type application/json
Basic Error
Basic Error
object
message
string
documentation_url
string
url
string
status
string
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed, or the endpoint has been spammed.
Media type application/json
Validation Error
Validation Error
object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
integer
Array<string>
Example generated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}