Discussions
File upload issue through API - "asset data must be provided" error
3 months ago by Quanyi Mo
Hello! I'm experiencing an issue with file uploads through the HeyGen API. Despite having a Pro subscription, when I try to upload an image or audio file, I get the error "asset data must be provided".
Details:
- API Key: MTdhNzdmMD**
- Endpoint: https://upload.heygen.com/v1/asset
- Method: POST
- Headers: X-Api-Key, Content-Type: multipart/form-data
- Data Format: FormData with file
What I've Tried:
- Different endpoints (api.heygen.com/v1/asset, upload.heygen.com/v1/asset)
- Different headers (X-Api-Key, Authorization: Bearer)
- Different field names (file, image, asset, data, photo, upload)
- Different data formats (FormData with Blob, FormData with Buffer, Base64 JSON)
- Different file types (JPEG, PNG, WAV, MP3)
Result:
All attempts return a 400 BAD REQUEST error with the message:
{"code":40001,"message":"asset data must be provided"}
Questions:
- Are additional permissions required for uploading user files with a Pro subscription?
- Am I using the API correctly for file uploads?
- Are there any restrictions or requirements I'm not considering?
- Can you provide a working example of file upload?
Goal:
I need to create videos with custom avatars (from uploaded photos) and custom voices (from uploaded audio) for a Telegram bot.
Additional Information:
- The API key works for fetching voice and avatar lists
- The issue only occurs when uploading files
- I'm using Node.js with the form-data library
Thank you in advance for your help!