Discussions

Ask a Question
Back to All

Creating TTS jobs documentation is misleading

According to the docs (https://docs.play.ht/reference/api-generate-audio) This should work (NOTE the null values):

curl --request POST --url https://api.play.ht/api/v2/tts --header "Authorization: Bearer $PLAYHT_SECRET_KEY" --header "X-USER-ID: $PLAYHT_USER_ID" --header 'content-type: application/json' --header 'Accept: application/json' -d '
{
    "text": "What is life?",
    "voice": "s3://mockingbird-prod/abigail_vo_6661b91f-4012-44e3-ad12-589fbdee9948/voices/speaker/manifest.json",
    "quality": "low",
    "output_format": "mp3",
    "voice_engine": "PlayHT2.0",
    "emotion": "female_happy",
    "speed": 1,
    "temperature": null,
    "sample_rate": 24000,
    "seed": null,
    "voice_guidance": null,
    "style_guidance": null
}'

{"error_message":"An unexpected error occurred, please wait a few moments and try again. If the problem persists, please contact support.","error_id":"UNEXPECTED_ERROR"}%

Alas, no. The problem is, the remote API endpoint can't deserialize null vals, even though the docs explicitly mention them 😮‍💨

This works like a charm, though (NOTE: omitted the null vals):

curl --request POST --url https://api.play.ht/api/v2/tts --header "Authorization: Bearer $PLAYHT_SECRET_KEY" --header "X-USER-ID: $PLAYHT_USER_ID" --header 'content-type: application/json' --header 'Accept: application/json' -d '{
    "text": "What is life?",
    "voice": "s3://mockingbird-prod/abigail_vo_6661b91f-4012-44e3-ad12-589fbdee9948/voices/speaker/manifest.json",
    "quality": "low",
    "output_format": "mp3",
    "voice_engine": "PlayHT2.0",
    "emotion": "female_happy",
    "speed": 1,
    "sample_rate": 24000
}'

So, I'd suggest either updating the API docs or fix this in the backend