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
expireoptionalstring: never | 1hour | 12hours | 1day | 7days | 15daysWhen set, the gist is automatically deleted after the given delay.
expires_atoptionalstring <date-time>A custom expiration date (RFC3339). When set it takes precedence over expire.
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.