Discussions

Ask a Question
Back to all

Technical Issue: Persistent 40001 Error on v1/asset Upload Endpoint (Multipart/Form-Data Failure)

Subject: Technical Issue: Persistent 40001 Error on v1/asset Upload Endpoint (Multipart/Form-Data Failure)

Dear HeyGen Engineering Team,

I am writing to report a persistent critical issue regarding the Asset Upload API (https://upload.heygen.com/v1/asset). I am integrating HeyGen into a web application, currently testing on the Free Plan.

While the Video Generation (v2/video/generate) endpoint works perfectly when using existing Asset IDs, I am unable to upload new assets via the API.

The Error: Every attempt to upload an image (.jpg) or audio (.mp3) file results in the following response: 400 Bad Request: { "code": 40001, "message": "asset data must be provided" }

Technical Debugging Steps Taken: To rule out client-side errors, I have tested the following scenarios, all resulting in the same 40001 error:

Python requests Library: Standard multipart/form-data upload using the files parameter.

Explicit MIME Types: Manually defining content_type as image/jpeg or audio/mpeg within the multipart payload.

Raw cURL Requests: Testing directly via terminal to bypass library-specific formatting issues.

Environment Check: Tested on both a local Windows machine and a cloud environment (Google Colab) to rule out local firewall/network interference. SSL verification was also disabled (verify=False) for testing purposes.

Current Observation:

API Upload: Fails consistently (40001).

Manual Upload: Uploading the same files via the HeyGen Dashboard (GUI) works perfectly.

Video Generation: Using the Asset IDs obtained from the manual dashboard upload, I can successfully generate videos via the API.

Conclusion: The issue is strictly isolated to the v1/asset endpoint handling the multipart payload.

My Question: Is the API Upload feature (v1/asset) currently restricted for Free Tier accounts, or is there a known regression/bug regarding multipart boundary handling on this endpoint?

I would appreciate your guidance on how to resolve this, as it is a blocker for our automation workflow.

Best regards,