Skip to content

Update a gist

PATCH/gists/{uuid}

Updates a gist owned by the authenticated caller. Only fields present in the body are changed; omitted fields are left untouched, and at least one of title, description, visibility or files must be supplied.

Each entry in files is keyed by the current filename and may:

  • set content to replace the file body;
  • set filename to rename the file;
  • set both to do both at once;
  • be null (or carry neither field) to delete the file.

A key that doesn't match an existing filename adds a new file, in which case content is required.

A private gist resolves only for its owner with a gist:read-capable token; other callers get 404. A visible gist the caller doesn't own returns 403.

Request

Headers

NameTypeScopes
Authorizationrequiredstringgist:write

Path parameters

NameTypeDescription
uuidrequiredstringThe gist's UUID.

Body parameters

GistUpdateRequestrequiredapplication/json

FieldTypeDescription
titleoptionalstring
descriptionoptionalstring
visibilityoptionalstring: public | unlisted | private
filesoptionalmap<string, GistUpdateFileInput | null>Files keyed by their current filename.
contentoptionalstringNew file body. Required when the key names a new file.
filenameoptionalstringNew name for the file (rename).

Responses

StatusBodyDescription
200GistThe updated gist.
401ErrorMissing or invalid credentials.
403ErrorThe token lacks the required scope or permission.
404ErrorThe requested resource does not exist (or is not visible to the caller).
422ErrorThe request body failed validation.