Sample - GitHub REST API
GET/gists/{gist_id}/{sha}

Get a gist revision

Retrieves a specific revision of a gist. Supply gist_id and sha to identify the gist and revision to retrieve; request the raw media type when you need the revision's raw Markdown content. A 200 response returns the selected gist revision and its metadata.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters
gist_idstringrequired
The unique identifier of the gist containing the revision.
shastringrequired
The identifier of the gist revision to retrieve.

4 status codes
200Returns the requested gist revision object, including its identifier, URLs, files, visibility, description, and timestamps.
forksarray<object>deprecatedoptional
historyarray<GistHistory>deprecatedoptional
fork_ofobjectoptional
Gist
urlstringoptional
forks_urlstringoptional
commits_urlstringoptional
idstringoptional
node_idstringoptional
git_pull_urlstringoptional
git_push_urlstringoptional
html_urlstringoptional
filesobjectoptional
publicbooleanoptional
created_atstringoptional
updated_atstringoptional
descriptionstringoptional
commentsintegeroptional
comments_enabledbooleanoptional
userstringoptional
comments_urlstringoptional
ownerobjectoptional
A GitHub user.
truncatedbooleanoptional
403Returned when access to the requested gist revision is forbidden.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the specified gist or revision cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 403 is returned when the authenticated user is not permitted to access the revision. A 404 is returned when gist_id or sha does not identify an available revision. A 422 is returned when validation fails or the endpoint detects that it has been spammed.