Discussions

Ask a Question
Back to all

File upload issue through API - "asset data must be provided" error

Copy from https://community.heygen.com/public/forum/boards/general-j8h/posts/file-upload-issue-through-api-asset-data-must-be-provided-error-q2y5749vf2


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:

What I've Tried:

  1. Different endpoints (api.heygen.com/v1/asset, upload.heygen.com/v1/asset)
  2. Different headers (X-Api-Key, Authorization: Bearer)
  3. Different field names (file, image, asset, data, photo, upload)
  4. Different data formats (FormData with Blob, FormData with Buffer, Base64 JSON)
  5. 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:

  1. Are additional permissions required for uploading user files with a Pro subscription?
  2. Am I using the API correctly for file uploads?
  3. Are there any restrictions or requirements I'm not considering?
  4. 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!