← All tags

Gists API Reference

View, modify your gists.

20 endpoints tagged gists, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

List gists for the authenticated user

GET /gists

Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists:

Parameters

NameInRequiredDescription
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes

Create a gist

POST /gists

Allows you to add a new gist with one or more files.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes

List public gists

GET /gists/public

List public gists sorted by most recently updated to least recently updated.

Parameters

NameInRequiredDescription
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
403Forbiddenyes

List starred gists

GET /gists/starred

List the authenticated user's starred gists:

Parameters

NameInRequiredDescription
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
401Requires authenticationyes
304Not modifiedno
403Forbiddenyes

Get a gist

GET /gists/{gist_id}

Gets a specified gist.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbidden Gistyes
404Resource not foundyes
304Not modifiedno

Update a gist

PATCH /gists/{gist_id}

Allows you to update a gist's description and to update, delete, or rename gist files. Files

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes

Delete a gist

DELETE /gists/{gist_id}

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
204Responseno
404Resource not foundyes
304Not modifiedno
403Forbiddenyes

List gist comments

GET /gists/{gist_id}/comments

Lists the comments on a gist.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes

Create a gist comment

POST /gists/{gist_id}/comments

Creates a comment on a gist.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
201Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes

Get a gist comment

GET /gists/{gist_id}/comments/{comment_id}

Gets a comment on a gist.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbidden Gistyes

Update a gist comment

PATCH /gists/{gist_id}/comments/{comment_id}

Updates a comment on a gist.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Delete a gist comment

DELETE /gists/{gist_id}/comments/{comment_id}

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes

List gist commits

GET /gists/{gist_id}/commits

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
304Not modifiedno
403Forbiddenyes

List gist forks

GET /gists/{gist_id}/forks

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
304Not modifiedno
403Forbiddenyes

Fork a gist

POST /gists/{gist_id}/forks

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
201Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
403Forbiddenyes

Check if a gist is starred

GET /gists/{gist_id}/star

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
204Response if gist is starredno
404Not Found if gist is not starredyes
304Not modifiedno
403Forbiddenyes

Star a gist

PUT /gists/{gist_id}/star

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP method."

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
204Responseno
404Resource not foundyes
304Not modifiedno
403Forbiddenyes

Unstar a gist

DELETE /gists/{gist_id}/star

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes

Get a gist revision

GET /gists/{gist_id}/{sha}

Gets a specified gist revision.

Parameters

NameInRequiredDescription
gist_idpathyesThe unique identifier of the gist.
shapathyes

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes
403Forbiddenyes

List gists for a user

GET /users/{username}/gists

Lists public gists for the specified user:

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes