Sample - GitHub REST API
POST/gists/{gist_id}/forks

Fork a gist

Creates a fork of the specified gist for the authenticated user. Supply gist_id to identify the gist to fork. A 201 response returns the newly created gist object.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter
gist_idstringrequired
The unique identifier of the gist to fork.

5 status codes
201Returns the newly created gist fork object, including its identifier, URLs, files, visibility, and timestamps.
urlstringrequired
forks_urlstringrequired
commits_urlstringrequired
idstringrequired
node_idstringrequired
git_pull_urlstringrequired
git_push_urlstringrequired
html_urlstringrequired
filesobjectrequired
publicbooleanrequired
created_atstringrequired
updated_atstringrequired
descriptionstringrequired
commentsintegerrequired
comments_enabledbooleanoptional
userobjectrequired
A GitHub user.
comments_urlstringrequired
ownerobjectoptional
A GitHub user.
truncatedbooleanoptional
forksarrayoptional
historyarrayoptional
304Returned when the requested representation has not changed.
403Returned when the authenticated user is forbidden from creating a fork.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the specified gist cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 403 is returned when the authenticated user is not permitted to fork the gist. A 404 is returned when the gist identified by gist_id does not exist. A 422 is returned when validation fails or the endpoint detects that it has been spammed.