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
contentto replace the file body; - set
filenameto 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
| Name | Type | Scopes |
|---|---|---|
Authorizationrequired | string | gist:write |
Path parameters
| Name | Type | Description |
|---|---|---|
uuidrequired | string | The gist's UUID. |
Body parameters
GistUpdateRequestrequiredapplication/json
| Field | Type | Description |
|---|---|---|
titleoptional | string | |
descriptionoptional | string | |
visibilityoptional | string: public | unlisted | private | |
filesoptional | map<string, GistUpdateFileInput | null> | Files keyed by their current filename. |
↳contentoptional | string | New file body. Required when the key names a new file. |
↳filenameoptional | string | New name for the file (rename). |
Responses
| Status | Body | Description |
|---|---|---|
200 | Gist | The updated gist. |
401 | Error | Missing or invalid credentials. |
403 | Error | The token lacks the required scope or permission. |
404 | Error | The requested resource does not exist (or is not visible to the caller). |
422 | Error | The request body failed validation. |