Sample - GitHub REST API
POST/repos/{owner}/{repo}/releases

Create a release

Users with push access to the repository can create a release.

[!NOTE] If the commit identified by target_commitish (or, when target_commitish is omitted, the latest commit on the default branch) adds or modifies any file under .github/workflows/ relative to the repository's default branch, the authenticating token must be authorized to modify workflows. Otherwise, this endpoint returns 404 Not Found; some authentication paths surface 403 Resource not accessible by integration instead.

OAuth app tokens and personal access tokens (classic) need the workflow scope when the resolved target commit modifies workflow files. Fine-grained access tokens and GitHub App installation tokens also need the "Workflows" repository permission (write). The GITHUB_TOKEN available to GitHub Actions cannot be authorized for this; for more information, see "Automatic token authentication".

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."

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

2 parameters · 9 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
tag_namestringrequired
The name of the tag.
target_commitishstringoptional
Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch.
namestringoptional
The name of the release.
bodystringoptional
Text describing the contents of the tag.
draftbooleanoptional
`true` to create a draft (unpublished) release, `false` to create a published one.
Default:false
prereleasebooleanoptional
`true` to identify the release as a prerelease. `false` to identify the release as a full release.
Default:false
discussion_category_namestringoptional
If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see "[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository)."
generate_release_notesbooleanoptional
Whether to automatically generate the name and body for this release. If `name` is specified, the specified name will be used; otherwise, a name will be automatically generated. If `body` is specified, the body will be pre-pended to the automatically generated notes.
Default:false
make_lateststringoptional
Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to `true` for newly published releases. `legacy` specifies that the latest release should be determined based on the release creation date and higher semantic version.
Allowed:truefalselegacyDefault:true

3 status codes
201Response
urlstringrequired
html_urlstringrequired
assets_urlstringrequired
upload_urlstringrequired
tarball_urlstringrequired
zipball_urlstringrequired
idintegerrequired
node_idstringrequired
tag_namestringrequired
The name of the tag.
target_commitishstringrequired
Specifies the commitish value that determines where the Git tag is created from.
namestringrequired
bodystringoptional
draftbooleanrequired
true to create a draft (unpublished) release, false to create a published one.
prereleasebooleanrequired
Whether to identify the release as a prerelease or a full release.
immutablebooleanoptional
Whether or not the release is immutable.
created_atstringrequired
published_atstringrequired
updated_atstringoptional
authorobjectrequired
A GitHub user.
assetsarray<ReleaseAsset>required
body_htmlstringoptional
body_textstringoptional
mentions_countintegeroptional
discussion_urlstringoptional
The URL of the release discussion.
reactionsobjectoptional
404Not Found if the discussion category name is invalid
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned: Not Found if the discussion category name is invalid. A 422 is returned: Validation failed, or the endpoint has been spammed.