openapi: 3.0.3
info:
version: 1.1.4
title: GitHub Application About Gists API
description: 'Use the REST API to retrieve information about GitHub Apps and GitHub App
installations.'
license:
name: MIT
url: https://spdx.org/licenses/MIT
termsOfService: https://docs.github.com/articles/github-terms-of-service
contact:
name: Support
url: https://support.github.com/contact?tags=dotcom-rest-api
x-github-plan: ghes
x-github-release: 3.9
servers:
- url: '{protocol}://{hostname}/api/v3'
variables:
hostname:
description: Self-hosted Enterprise Server hostname
default: HOSTNAME
protocol:
description: Self-hosted Enterprise Server protocol
default: http
tags:
- name: Gists
paths:
/gists/public:
get:
summary: GitHub List Public Gists
description: 'List public gists sorted by most recently updated to least recently updated.
Note: With [pagination](https://docs.github.com/enterprise-server@3.9/rest/guides/using-pagination-in-the-rest-api), 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.'
tags:
- Gists
operationId: listPublicGists
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#list-public-gists
parameters:
- $ref: '#/components/parameters/since'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/page'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/base-gist'
examples:
default:
$ref: '#/components/examples/base-gist-items'
headers:
Link:
$ref: '#/components/headers/link'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/starred:
get:
summary: GitHub List Starred Gists
description: The GitHub Gists API endpoint GET /gists/starred retrieves a list of all gists that the authenticated user has starred. This operation requires authentication and returns a paginated collection of gist objects, each containing metadata such as the gist's ID, description, owner information, files, creation and update timestamps, and visibility status. The endpoint supports standard pagination parameters to navigate through the results, allowing developers to programmatically access and manage the user's starred gists for integration into applications, backup utilities, or personal gist management tools.
tags:
- Gists
operationId: listStarredGists
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#list-starred-gists
parameters:
- $ref: '#/components/parameters/since'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/page'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/base-gist'
examples:
default:
$ref: '#/components/examples/base-gist-items'
headers:
Link:
$ref: '#/components/headers/link'
'304':
$ref: '#/components/responses/not_modified'
'401':
$ref: '#/components/responses/requires_authentication'
'403':
$ref: '#/components/responses/forbidden'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}:
get:
summary: GitHub Getgist
description: 'Gets a specified gist.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: getgist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#get-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/gist-simple'
examples:
default:
$ref: '#/components/examples/gist'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden_gist'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
patch:
summary: GitHub Updategist
description: 'Allows you to update a gist''s description and to update, delete, or rename gist files. Files
from the previous version of the gist that aren''t explicitly changed during an edit
are unchanged.
At least one of `description` or `files` is required.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: updategist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#update-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
requestBody:
required: true
content:
application/json:
schema:
properties:
description:
description: The description of the gist.
example: Example Ruby script
type: string
files:
description: 'The gist files to be updated, renamed, or deleted. Each `key` must match the current filename
(including extension) of the targeted gist file. For example: `hello.py`.
To delete a file, set the whole file to null. For example: `hello.py : null`. The file will also be
deleted if the specified object does not contain at least one of `content` or `filename`.'
example:
hello.rb:
content: blah
filename: goodbye.rb
type: object
additionalProperties:
type: object
nullable: true
properties:
content:
description: The new content of the file.
type: string
filename:
description: The new filename for the file.
type: string
nullable: true
type: object
nullable: true
examples:
updateGist:
summary: Updating a gist
value:
description: An updated gist description
files:
README.md:
content: Hello World from GitHub
deleteFile:
summary: Deleting a gist file
value:
files:
hello.py: null
renameFile:
summary: Renaming a gist file
value:
files:
hello.py:
filename: goodbye.py
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/gist-simple'
examples:
updateGist:
$ref: '#/components/examples/gist'
deleteFile:
$ref: '#/components/examples/delete-gist-file'
renameFile:
$ref: '#/components/examples/rename-gist-file'
'404':
$ref: '#/components/responses/not_found'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: GitHub Deletegist
description: The DELETE operation on the /gists/{gist_id} endpoint allows authenticated users to permanently remove a specific gist from GitHub. This operation requires the gist_id path parameter to identify which gist should be deleted, and the user must be authenticated with proper authorization scopes (typically the 'gist' scope) to perform the deletion. Once executed successfully, the gist and all its associated content, revisions, and metadata are permanently removed from GitHub's servers and cannot be recovered. The operation returns a 204 No Content status code upon successful deletion, or appropriate error codes if the gist doesn't exist, the user lacks permission, or authentication fails.
tags:
- Gists
operationId: deletegist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#delete-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'204':
description: Response
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/comments:
get:
summary: GitHub List Gist Comments
description: 'Lists the comments on a gist.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: listGistComments
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/comments#list-gist-comments
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/page'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/gist-comment'
examples:
default:
$ref: '#/components/examples/gist-comment-items'
headers:
Link:
$ref: '#/components/headers/link'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: comments
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: GitHub Creategist Comment
description: 'Creates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: creategistComment
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/comments#create-a-gist-comment
parameters:
- $ref: '#/components/parameters/gist-id'
requestBody:
required: true
content:
application/json:
schema:
properties:
body:
description: The comment text.
type: string
maxLength: 65535
example: Body of the attachment
type: object
required:
- body
examples:
default:
summary: Creating a comment in a gist
value:
body: This is a comment to a gist
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/gist-comment'
examples:
default:
$ref: '#/components/examples/gist-comment'
headers:
Location:
example: https://api.github.com/gists/a6db0bec360bb87e9418/comments/1
schema:
type: string
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: comments
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/comments/{comment_id}:
get:
summary: GitHub Getgist Comment
description: 'Gets a comment on a gist.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: getgistComment
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/comments#get-a-gist-comment
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/comment-id'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/gist-comment'
examples:
default:
$ref: '#/components/examples/gist-comment'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden_gist'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: comments
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
patch:
summary: GitHub Updategist Comment
description: 'Updates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
operationId: updategistComment
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/comments#update-a-gist-comment
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/comment-id'
requestBody:
required: true
content:
application/json:
schema:
properties:
body:
description: The comment text.
type: string
maxLength: 65535
example: Body of the attachment
type: object
required:
- body
examples:
default:
summary: Updating a comment in a gist
value:
body: This is an update to a comment in a gist
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/gist-comment'
examples:
default:
$ref: '#/components/examples/gist-comment'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: comments
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: GitHub Deletegist Comment
description: This API operation allows you to delete a specific comment from a GitHub Gist by providing both the gist ID and the comment ID in the endpoint path. When executed, it permanently removes the targeted comment from the specified Gist, requiring proper authentication and authorization to ensure only the comment author or users with appropriate permissions can perform the deletion. The operation uses the DELETE HTTP method and returns a success status code when the comment is successfully removed from the Gist's comment thread.
tags:
- Gists
operationId: deletegistComment
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/comments#delete-a-gist-comment
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/comment-id'
responses:
'204':
description: Response
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: comments
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/commits:
get:
summary: GitHub List Gist Commits
description: This API endpoint retrieves the commit history for a specific GitHub Gist by making a GET request to /gists/{gist_id}/commits, where {gist_id} is the unique identifier of the Gist you want to query. The response returns a chronological list of all commits made to that Gist, including information such as the commit version, URL, user who made the commit, timestamp of when it was committed, and change statistics showing additions, deletions, and total changes. This is particularly useful for tracking the evolution of a Gist over time, auditing changes, or implementing version control features in applications that work with Gists, allowing developers to see who modified the content and when those modifications occurred.
tags:
- Gists
operationId: listGistCommits
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#list-gist-commits
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/page'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/gist-commit'
examples:
default:
$ref: '#/components/examples/gist-commit-items'
headers:
Link:
example: <https://api.github.com/resource?page=2>; rel="next"
schema:
type: string
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/forks:
get:
summary: GitHub List Gist Forks
description: This API endpoint retrieves a list of all forks for a specific GitHub Gist identified by its gist_id parameter. When called with a GET request, it returns an array of fork objects, each containing details about users who have forked the gist, including their user information, the fork's creation date, and the forked gist's URL. This is useful for tracking how widely a gist has been shared and reused across the GitHub community, allowing developers to see who has created their own copy of the original gist and potentially made modifications to it.
tags:
- Gists
operationId: listGistForks
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#list-gist-forks
parameters:
- $ref: '#/components/parameters/gist-id'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/page'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/gist-simple'
examples:
default:
$ref: '#/components/examples/gist-fork-items'
headers:
Link:
$ref: '#/components/headers/link'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: GitHub Forkgist
description: This API endpoint allows authenticated users to create a fork (copy) of an existing gist by making a POST request to /gists/{gist_id}/forks, where {gist_id} is the unique identifier of the gist to be forked. When executed successfully, it creates a duplicate of the specified gist under the authenticated user's account, preserving all the original files and content while establishing a relationship between the forked gist and its parent. This operation requires authentication and returns the newly created forked gist object containing its own unique identifier, URLs, and metadata, making it useful for developers who want to build upon or customize existing code snippets shared by others in the GitHub community.
tags:
- Gists
operationId: forkgist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#fork-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/base-gist'
examples:
default:
$ref: '#/components/examples/base-gist'
headers:
Location:
example: https://api.github.com/gists/aa5a315d61ae9438b18d
schema:
type: string
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/star:
get:
summary: GitHub Check Ifgist is Starred
description: 'The Check If A Gist Is Starred operation is a GET request to the /gists/{gist_id}/star endpoint that allows authenticated users to verify whether they have starred a specific gist. This endpoint requires the gist_id path parameter to identify the target gist and returns a boolean-style HTTP status response: 204 No Content if the gist is starred by the authenticated user, or 404 Not Found if it is not starred or does not exist. This operation is useful for applications that need to display or track a user''s starred gists, enable conditional UI elements like star/unstar buttons, or maintain synchronization of gist preferences across different platforms.'
tags:
- Gists
operationId: checkIfgistIsStarred
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#check-if-a-gist-is-starred
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'204':
description: Response if gist is starred
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
description: Not Found if gist is not starred
content:
application/json:
schema:
type: object
properties: {}
additionalProperties: false
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: GitHub Stargist
description: Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP method](https://docs.github.com/enterprise-server@3.9/rest/guides/getting-started-with-the-rest-api#http-method)."
tags:
- Gists
operationId: stargist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#star-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'204':
description: Response
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: GitHub Unstargist
description: This API operation allows authenticated users to remove their star from a previously starred GitHub Gist by sending a DELETE request to the endpoint with the specific Gist ID. When executed successfully, it removes the user's star designation from the specified Gist, effectively indicating that the user no longer wishes to mark that Gist as a favorite or bookmark it for later reference. This is part of GitHub's Gist starring functionality that helps users curate and organize code snippets they find valuable or want to track.
tags:
- Gists
operationId: unstargist
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/gists/gists#unstar-a-gist
parameters:
- $ref: '#/components/parameters/gist-id'
responses:
'204':
description: Response
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: false
category: gists
subcategory: gists
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/gists/{gist_id}/{sha}:
get:
summary: GitHub Getgist Revision
description: 'Gets a specified gist revision.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw markdown. This is the default if you do not pass any specific media type.
- **`application/vnd.github.base64+json`**: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.'
tags:
- Gists
o
# --- truncated at 32 KB (686 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/github/refs/heads/main/openapi/github-gists-api-openapi.yml