Discussions

Ask a Question
Back to all

v1/asset upload still failing - "asset data must be provided" error Message:

Hi HeyGen Engineering Team,
I'm still getting the "asset data must be provided" error (40001) when trying to upload photos to the v1/asset endpoint, even after following the support team's guidance.
My Current Setup:
API Key: skV2_hgu_kewGSY61UdW_hA6n9Qp20KSApU1Tj8HnDeDw6mJzmymR
Endpoint: https://upload.heygen.com/v1/asset
Method: POST
Headers: X-Api-Key: sk_V2
...
Current Code (Node.js):

const formData = new FormData();
const blob = new Blob([imageBlob], { type: 'image/jpeg' });
formData.append('file', blob, 'avatar.jpg');

const response = await fetch('https://upload.heygen.com/v1/asset', {
method: 'POST',
headers: {
'X-Api-Key': HEYGEN_API_KEY
},
body: formData
});

What I've Tried:
✅ Using v1/asset endpoint (as recommended by support)
✅ FormData with 'file' field
✅ Manual multipart construction
✅ Different field names ('file', 'asset', 'image')
✅ Both FormData and manual multipart
The Error:

Status: 400
Code: 40001
Message: "asset data must be provided"

Questions:
Can you provide a working Node.js example for v1/asset upload?
What's the exact request format you expect?
Are there any specific requirements for the image data?
Is there a different endpoint I should be using?
My Use Case: Building a platform where users upload photos to create AI avatars.
Thanks for your help!