# Create a release

From **GitHub v3 REST API**.

`POST /repos/{owner}/{repo}/releases`

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

This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. See "[Secondary rate limits](https://docs.github.com/enterprise-server@3.0/rest/overview/resources-in-the-rest-api#secondary-rate-limits)" and "[Dealing with secondary rate limits](https://docs.github.com/enterprise-server@3.0/rest/guides/best-practices-for-integrators#dealing-with-secondary-rate-limits)" for details.

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "body": "Description of the release",
  "draft": false,
  "name": "v1.0.0",
  "prerelease": false,
  "tag_name": "v1.0.0",
  "target_commitish": "master"
}
```

```json
{"properties":{"body":{"description":"Text describing the contents of the tag.","type":"string"},"draft":{"default":false,"description":"`true` to create a draft (unpublished) release, `false` to create a published one.","type":"boolean"},"name":{"description":"The name of the release.","type":"string"},"prerelease":{"default":false,"description":"`true` to identify the release as a prerelease. `false` to identify the release as a full release.","type":"boolean"},"tag_name":{"description":"The name of the tag.","type":"string"},"target_commitish":{"description":"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 (usually `master`).","type":"string"}},"required":["tag_name"],"type":"object"}
```

## Responses

### `201`

Response

#### Headers

##### `Location`

- Type: `string`

- Example: `https://api.github.com/repos/octocat/Hello-World/releases/1`

### `application/json`

- Type: `object`

A release.

```json
{
  "assets": [
    {
      "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip",
      "content_type": "application/zip",
      "created_at": "2013-02-27T19:35:32Z",
      "download_count": 42,
      "id": 1,
      "label": "short description",
      "name": "example.zip",
      "node_id": "MDEyOlJlbGVhc2VBc3NldDE=",
      "size": 1024,
      "state": "uploaded",
      "updated_at": "2013-02-27T19:35:32Z",
      "uploader": {
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
        "followers_url": "https://api.github.com/users/octocat/followers",
        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
        "gravatar_id": "",
        "html_url": "https://github.com/octocat",
        "id": 1,
        "login": "octocat",
        "node_id": "MDQ6VXNlcjE=",
        "organizations_url": "https://api.github.com/users/octocat/orgs",
        "received_events_url": "https://api.github.com/users/octocat/received_events",
        "repos_url": "https://api.github.com/users/octocat/repos",
        "site_admin": false,
        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
        "type": "User",
        "url": "https://api.github.com/users/octocat"
      },
      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1"
    }
  ],
  "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
  "author": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/octocat",
    "id": 1,
    "login": "octocat",
    "node_id": "MDQ6VXNlcjE=",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/octocat"
  },
  "body": "Description of the release",
  "created_at": "2013-02-27T19:35:32Z",
  "discussion_url": "https://github.com/octocat/Hello-World/discussions/90",
  "draft": false,
  "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
  "id": 1,
  "name": "v1.0.0",
  "node_id": "MDc6UmVsZWFzZTE=",
  "prerelease": false,
  "published_at": "2013-02-27T19:35:32Z",
  "tag_name": "v1.0.0",
  "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
  "target_commitish": "master",
  "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
  "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0"
}
```

```json
{"description":"A release.","properties":{"assets":{"items":{"$ref":"#/components/schemas/release-asset"},"type":"array"},"assets_url":{"format":"uri","type":"string"},"author":{"$ref":"#/components/schemas/simple-user"},"body":{"nullable":true,"type":"string"},"body_html":{"type":"string"},"body_text":{"type":"string"},"created_at":{"format":"date-time","type":"string"},"draft":{"description":"true to create a draft (unpublished) release, false to create a published one.","example":false,"type":"boolean"},"html_url":{"format":"uri","type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"node_id":{"type":"string"},"prerelease":{"description":"Whether to identify the release as a prerelease or a full release.","example":false,"type":"boolean"},"published_at":{"format":"date-time","nullable":true,"type":"string"},"reactions":{"$ref":"#/components/schemas/reaction-rollup"},"tag_name":{"description":"The name of the tag.","example":"v1.0.0","type":"string"},"tarball_url":{"format":"uri","nullable":true,"type":"string"},"target_commitish":{"description":"Specifies the commitish value that determines where the Git tag is created from.","example":"master","type":"string"},"upload_url":{"type":"string"},"url":{"format":"uri","type":"string"},"zipball_url":{"format":"uri","nullable":true,"type":"string"}},"required":["assets_url","upload_url","tarball_url","zipball_url","created_at","published_at","draft","id","node_id","author","html_url","name","prerelease","tag_name","target_commitish","assets","url"],"title":"Release","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/releases \
  --header 'content-type: application/json' \
  --data '{
  "body": "Description of the release",
  "draft": false,
  "name": "v1.0.0",
  "prerelease": false,
  "tag_name": "v1.0.0",
  "target_commitish": "master"
}'
```
