Skip to content

Create a gist

POST/gists

Creates a gist owned by the authenticated caller.

Files are provided as an object keyed by filename. Entries without a content value are dropped; at least one file with content is required. When title is omitted it is derived from the first filename.

Request

Headers

NameTypeScopes
Authorizationrequiredstringgist:write

Body parameters

GistCreateRequestrequiredapplication/json

FieldTypeDescription
titleoptionalstringOptional; derived from the first filename when omitted.
descriptionoptionalstring
visibilityoptionalstring: public | unlisted | private
filesrequiredmap<string, GistCreateFileInput>Files keyed by filename. At least one entry must have content.
contentoptionalstringFile body. Entries without content are dropped.

Responses

StatusBodyDescription
201GistThe created gist.
Headers:Location
401ErrorMissing or invalid credentials.
403ErrorThe token lacks the required scope or permission.
422ErrorThe request body failed validation.