---
title: "Get a repository README for a directory"
method: GET
path: "/repos/{owner}/{repo}/readme/{dir}"
tags: ["repos"]
---

# Get a repository README for a directory

`GET /repos/{owner}/{repo}/readme/{dir}`

Gets the README from a repository directory.

This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.8/rest/using-the-rest-api/getting-started-with-the-rest-api#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](https://github.com/github/markup).

## Path parameters

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

## Query parameters

- `ref` string

## Response `200`

Response

- ContentFile — Content File
  - `type` 'file', required
  - `encoding` string, required
  - `size` integer, required
  - `name` string, required
  - `path` string, required
  - `content` string, required
  - `sha` string, required
  - `url` string, uri, required
  - `git_url` string, uri, nullable, required
  - `html_url` string, uri, nullable, required
  - `download_url` string, uri, nullable, required
  - `_links` object, required
    - `git` string, uri, nullable, required
    - `html` string, uri, nullable, required
    - `self` string, uri, required
  - `target` string
  - `submodule_git_url` string

## Other responses

- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

---

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