Sample - GitHub REST API
PATCH/gists/{gist_id}

Update a gist

Allows you to update a gist's description and to update, delete, or rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.

At least one of description or files is required.

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

  • application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.
  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 2 body fields
gist_idstringrequired
The unique identifier of the gist.
descriptionstringoptional
The description of the gist.
filesobjectoptional
The gist files to be updated, renamed, or deleted. Each `key` must match the current filename (including extension) of the targeted gist file. For example: `hello.py`. To delete a file, set the whole file to null. For example: `hello.py : null`. The file will also be deleted if the specified object does not contain at least one of `content` or `filename`.

3 status codes
200Response
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
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned: Resource not found. A 422 is returned: Validation failed, or the endpoint has been spammed.