POST/repos/{owner}/{repo}/releases/{release_id}/assets

Upload a release asset

Uploads a binary asset to a specific release in a repository. Use the release-specific upload_url returned when creating the release, provide the asset filename in name, and send the raw file data with a media-type Content-Type header. The API may rename filenames containing special characters or leading or trailing periods.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

5 parameters
ownerstringrequired
The account owner of the repository; the name is not case sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case sensitive.
release_idintegerrequired
The unique identifier of the release to which you are uploading the asset.
namestringrequired
The filename to use for the uploaded asset.
labelstringoptional
An optional label for the asset.

2 status codes
201Returns the created release asset object, including its identifier, filename, content type, size, digest, state, download URL, download count, timestamps, and uploader.
urlstringrequired
browser_download_urlstringrequired
idintegerrequired
node_idstringrequired
namestringrequired
The file name of the asset.
labelstringrequired
statestringrequired
State of the release asset.
Allowed:uploadedopen
content_typestringrequired
sizeintegerrequired
digeststringrequired
download_countintegerrequired
created_atstringrequired
updated_atstringrequired
uploaderobjectrequired
A GitHub user.
422Returned when an asset with the same filename has already been uploaded to the release.

Error handling

The owner and repo path parameters identify the repository, and the release_id path parameter identifies the release. A 422 is returned if an asset with the same filename already exists; delete the existing asset before retrying with a different name query parameter. Send raw binary data as the request body with a media-type Content-Type header, and use an HTTP client that supports SNI.