Response Body

ParameterDescription
idid of uploaded asset
namename of uploaded asset
file_typefile type of uploaded asset (image, video)
folder_idfolder of this asset
metametadata of this asset

The response will provide you with an id, representing the asset ID of the uploaded image.

Image

Specify the content type of the image, which should be image/jpeg for JPEG files or image/png for PNG files. The API will respond with an id that represens your asset.

File typeContent type
JPEGimage/jpeg
PNGimage/png

Video

Specify the content type of the video, which should be video/mp4 for MP4 files or video/webm for WEBM files. The API will respond with an id that represents your asset.

File typeContent type
MP4video/mp4
WEBMvideo/webm

Audio

Specify the content type of the audio, which should be audio/mpeg for MPEG files. The API will respond with an id that represents your asset.

File typeContent type
MPEGaudio/mpeg

Example Usage

import requests

url = "https://upload.heygen.com/v1/asset"
headers = {
    "Content-Type": "image/jpeg",
    "X-Api-Key": "xxx",
}

# Path to the image file
file_path = "/Users/user/Documents/image.jpg"

# Open the file in binary mode and send it with a POST request
with open(file_path, "rb") as file:
    response = requests.post(url, headers=headers, data=file)


print(response.status_code)
print(response.json())
200
{'code': 100, 'data': {'id': 'eeb5d93b927c4ea38bf2503b0db5d4d6', 'name': 'eeb5d93b927c4ea38bf2503b0db5d4d6', 'file_type': 'image', 'folder_id': '', 'meta': None, 'created_ts': 1722360649, 'url': 'https://resource2.heygen.ai/image/...'}, 'msg': None, 'message': None}
Language
Authorization
Header
Click Try It! to start a request and see the response here!