Discussions
Unable to delete Avatar Groups via API
Hi,
I'm having trouble with deleting Avatar Groups through the API. While I can successfully delete Avatar Groups through the web interface at app.heygen.com, the API request returns a 401 Unauthorized error.
Here are the details:
The web interface DELETE request that works:
URL: https://api2.heygen.com/v1/avatar_group.delete?id={group_id}
Status: 200 OK
The same request via API that fails:
URL: https://api2.heygen.com/v1/avatar_group.delete?id={group_id}
Headers:
x-api-key: [My valid API key]
accept: application/json
content-type: application/json
Response: {"code":400112,"message":"Unauthorized"}
Status: 401
I need this functionality to manage storage space in my account by cleaning up unused Avatar Groups. I've noticed that I have a storage limit, and it's crucial for my API implementation to properly clean up resources after use. Currently, I'm trying to implement automatic cleanup after generating a talking photo - I can delete the avatar inside the Avatar Group, but I can't delete the Avatar Group itself.
This is particularly important because:
With multiple API users, my account storage could quickly fill up
Just deleting the avatar inside the Avatar Group might not actually free up the storage space
I need to ensure each API operation (create talking photo -> generate video -> cleanup) is properly completed to maintain available storage space
I've tried implementing automatic cleanup in my code to trigger after successful video generation, but I'm unable to delete the Avatar Group due to this authorization issue. Could you please help me understand what I'm missing in the API request, or if there's another way to properly clean up resources?
Thank you for your help!