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

Upload a release asset

Uploads a binary asset to a release using the release-specific upload URL. Supply the required name query parameter and Content-Type header, and send the asset as raw binary data rather than JSON. Use the upload_url from the release creation response and remove an existing asset before reusing its filename.

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

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 attach the asset to.
namestringrequired
The filename to assign to the uploaded release asset.
labelstringoptional
An optional label for the release asset.

2 status codes
201Returns the created release asset, including its identifier, filename, media type, size, state, download URLs, digest, 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 another asset in the release already uses the supplied `name` filename.

Error handling

A 422 is returned when an asset uses the same filename as an existing release asset. name must identify the asset filename, and the request body must contain the raw binary asset data with a valid Content-Type.