Sample - GitHub REST API
GET/repos/{owner}/{repo}/pulls/{pull_number}/files

List pull requests files

Lists the files in a specified pull request.

[!NOTE] Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

5 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
pull_numberintegerrequired
The number that identifies the pull request.
per_pageintegeroptional
The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
Default:30
pageintegeroptional
The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
Default:1

4 status codes
200Response
shastringrequired
filenamestringrequired
statusstringrequired
Allowed:addedremovedmodifiedrenamedcopiedchangedunchanged
additionsintegerrequired
deletionsintegerrequired
changesintegerrequired
blob_urlstringrequired
raw_urlstringrequired
contents_urlstringrequired
patchstringoptional
previous_filenamestringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
500Internal Error
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
503Service unavailable
codestringoptional
messagestringoptional
documentation_urlstringoptional

Error handling

A 422 is returned: Validation failed, or the endpoint has been spammed. A 500 is returned: Internal Error. A 503 is returned: Service unavailable.