Skip to content

Get a raw file from a gist

GET/gists/{uuid}/files/{sha}/{filename}

Returns the raw bytes of filename as committed at sha. The Content-Type is derived from the detected mime type (embeddable types keep their type, other text is served as text/plain, everything else as application/octet-stream); X-Content-Type-Options: nosniff is always set, and SVG/PDF responses carry a restrictive Content-Security-Policy.

Visibility rules match the gist endpoint: public and unlisted gists are readable by anyone, while a private gist resolves only for its owner with a gist:read-capable token.

Request

Headers

NameTypeScopes
Authorizationoptionalstring

Path parameters

NameTypeDescription
uuidrequiredstringThe gist's UUID.
sharequiredstringA full or partial commit SHA (hex, 4–40 characters). (pattern: ^[0-9a-fA-F]{4,40}$)
filenamerequiredstringName of the file within the gist.

Responses

StatusBodyDescription
200string <binary>The raw file content.
400ErrorThe request was malformed.
404ErrorThe requested resource does not exist (or is not visible to the caller).