This page will help you authenticate to our API or SDKs.
Before you can start using our API or SDKs, you need to generate an API Secret Key and obtain your User ID. These are essential to authenticate your requests and access the API's features.
Generating Your API Secret Key and Obtaining Your User ID
Follow these steps to generate your API Secret key and get your User ID:
- Visit the API Access page play.ht/studio/api-access
- If you haven't already, sign in to your existing account.
- Click the "Generate Secret Key" button. Your API Secret Key will be displayed. Make sure to copy and store it securely.
- Find your User ID on the same page under the "User ID" section. Copy it for future reference.
Important: Keep your API Secret Key confidential. Do not share it with anyone or include it in publicly accessible code repositories.
Authenticating Your API Requests
After obtaining your API Secret Key and User ID, include them in your API requests to authenticate yourself and access the API's features.
Here are examples of requests with these credentials in the headers:
import * as PlayHT from 'playht';
PlayHT.init({
userId: '<YOUR_USER_ID>',
apiKey: '<YOUR_API_KEY>',
});
from pyht import Client
client = Client(
user_id="<YOUR_USER_ID>",
api_key="<YOUR_API_KEY>",
)
curl --request POST \
--url https://play.ht/api/v1/convert \
--header 'X-USER-ID: <YOUR_USER_ID>' \
--header 'AUTHORIZATION: <YOUR_API_KEY>' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"content": [
"Hey you!"
],
"voice": "en-US-JennyNeural"
}
'
POST /api/v1/convert HTTP/1.1
Host: play.ht
X-User-Id: <YOUR_USER_ID>
Authorization: <YOUR_API_KEY>
Replace <YOUR_USER_ID>
and <YOUR_API_KEY>
with your actual API Secret Key and User ID.