← 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
| Name | In | Required | Description |
|---|
since | query | no | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
per_page | query | no | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
page | query | no | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
Create a gist
POST /gists
Allows you to add a new gist with one or more files.
Parameters
No parameters.
Responses
| Status | Description | Has JSON body |
|---|
| 201 | Response | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |
| 304 | Not modified | no |
| 404 | Resource not found | yes |
| 403 | Forbidden | yes |
List public gists
GET /gists/public
List public gists sorted by most recently updated to least recently updated.
Parameters
| Name | In | Required | Description |
|---|
since | query | no | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
per_page | query | no | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
page | query | no | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
List starred gists
GET /gists/starred
List the authenticated user's starred gists:
Parameters
| Name | In | Required | Description |
|---|
since | query | no | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
per_page | query | no | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
page | query | no | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 401 | Requires authentication | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
Get a gist
GET /gists/{gist_id}
Gets a specified gist.
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 403 | Forbidden Gist | yes |
| 404 | Resource not found | yes |
| 304 | Not modified | no |
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
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |
| 404 | Resource not found | yes |
Delete a gist
DELETE /gists/{gist_id}
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 204 | Response | no |
| 404 | Resource not found | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
List gist commits
GET /gists/{gist_id}/commits
Parameters
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 404 | Resource not found | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
List gist forks
GET /gists/{gist_id}/forks
Parameters
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 404 | Resource not found | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
Fork a gist
POST /gists/{gist_id}/forks
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 201 | Response | yes |
| 404 | Resource not found | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
Check if a gist is starred
GET /gists/{gist_id}/star
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 204 | Response if gist is starred | no |
| 404 | Not Found if gist is not starred | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
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
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 204 | Response | no |
| 404 | Resource not found | yes |
| 304 | Not modified | no |
| 403 | Forbidden | yes |
Unstar a gist
DELETE /gists/{gist_id}/star
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
Responses
| Status | Description | Has JSON body |
|---|
| 204 | Response | no |
| 304 | Not modified | no |
| 404 | Resource not found | yes |
| 403 | Forbidden | yes |
Get a gist revision
GET /gists/{gist_id}/{sha}
Gets a specified gist revision.
Parameters
| Name | In | Required | Description |
|---|
gist_id | path | yes | The unique identifier of the gist. |
sha | path | yes | |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |
| 404 | Resource not found | yes |
| 403 | Forbidden | yes |
List gists for a user
GET /users/{username}/gists
Lists public gists for the specified user:
Parameters
| Name | In | Required | Description |
|---|
username | path | yes | The handle for the GitHub user account. |
since | query | no | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
per_page | query | no | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
page | query | no | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
Responses
| Status | Description | Has JSON body |
|---|
| 200 | Response | yes |
| 422 | Validation failed, or the endpoint has been spammed. | yes |