Discussions

Ask a Question
Back to All

update the payment method

Hey there! I've got a question. I still have around 143 credits left, but I'm getting a 401 error with the sample code I'm using. When I checked the billing view, it's asking to update the payment method because of recent payment failures. Does that mean even with remaining credits, I can't use the API key without updating the payment method? Also, it seems like the URLs for webhook and result_url might not be valid. Could that be causing issues with the code? Should I create new URLs and replace them in the code? Thanks!

import requests

url = "https://api.d-id.com/talks"

payload = {
"source_url": "https://path.to.directory/image.jpg",
"driver_url": "bank://natural",
"script": {
"type": "text",
"subtitles": True,
"provider": {
"type": "microsoft",
"voice_id": "en-US-JennyNeural",
"voice_config": {
"style": "string",
"rate": "0.5",
"pitch": "+2st"
}
},
"input": "This is an example text",
"ssml": True
},
"config": {
"logo": {
"url": "string",
"position": [0, 500]
},
"align_driver": True,
"align_expand_factor": 0,
"auto_match": True,
"motion_factor": 0,
"normalization_factor": 0,
"sharpen": True,
"stitch": True,
"result_format": "mp4",
"fluent": True,
"pad_audio": 0,
"driver_expressions": {
"expressions": [
{
"start_frame": 0,
"expression": "neutral",
"intensity": 0
}
],
"transition_frames": 0
},
"output_resolution": 512
},
"user_data": "string",
"name": "string",
"webhook": "https://host.domain.tld/to/webhook",
"result_url": "https://path.to.directory/",
"face": {
"top_left": [0, 0],
"size": 512
},
"persist": True
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer "
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)