Check if a gist is starred

octokit.gists.checkIsStarred({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Create a gist

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

Note: Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.

octokit.gists.create({
files,
files.*.content
})

Parameters

namerequireddescription
descriptionno

Description of the gist

filesyes

Names and content for the files that make up the gist

files.*no
files.*.contentyes

Content of the file

publicno

See also: GitHub Developer Guide documentation.

Create a gist comment

octokit.gists.createComment({
gist_id,
body,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

bodyyes

The comment text.

See also: GitHub Developer Guide documentation.

Delete a gist

octokit.gists.delete({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Delete a gist comment

octokit.gists.deleteComment({
gist_id,
comment_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

comment_idyes

comment_id parameter

See also: GitHub Developer Guide documentation.

Fork a gist

Note: This was previously /gists/:gist_id/fork.

octokit.gists.fork({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Get a gist

octokit.gists.get({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Get a gist comment

octokit.gists.getComment({
gist_id,
comment_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

comment_idyes

comment_id parameter

See also: GitHub Developer Guide documentation.

Get a gist revision

octokit.gists.getRevision({
gist_id,
sha,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

shayes

See also: GitHub Developer Guide documentation.

List gists for the authenticated user

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

octokit.gists.list();

Parameters

namerequireddescription
sinceno

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List gist comments

octokit.gists.listComments({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List gist commits

octokit.gists.listCommits({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List gist forks

octokit.gists.listForks({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List gists for a user

Lists public gists for the specified user:

octokit.gists.listForUser({
username,
});

Parameters

namerequireddescription
usernameyes
sinceno

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List public gists

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

Note: With pagination, you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.

octokit.gists.listPublic();

Parameters

namerequireddescription
sinceno

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List starred gists

List the authenticated user's starred gists:

octokit.gists.listStarred();

Parameters

namerequireddescription
sinceno

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

Star a gist

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

octokit.gists.star({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Unstar a gist

octokit.gists.unstar({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

See also: GitHub Developer Guide documentation.

Update a gist

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

octokit.gists.update({
gist_id,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

descriptionno

Description of the gist

filesno

Names of files to be updated

files.*no
files.*.contentno

The new content of the file

files.*.filenameno

The new filename for the file

See also: GitHub Developer Guide documentation.

Update a gist comment

octokit.gists.updateComment({
gist_id,
comment_id,
body,
});

Parameters

namerequireddescription
gist_idyes

gist_id parameter

comment_idyes

comment_id parameter

bodyyes

The comment text.

See also: GitHub Developer Guide documentation.