API Keys
To access the Faseeh API, you’ll need an API key. This key serves as your authentication credential and is required for all API requests.
How it works
Include your API key in every request by adding it to the x-api-key HTTP header:
API Key Features
Your API keys can be configured with:
- Endpoint restrictions: Control which API endpoints each key can access
- Usage limits: Set custom quotas to manage and monitor your API consumption
Security Best Practices
Keep your API key secure and private. Never commit it to version control, share it publicly, or include it in client-side applications where it could be exposed.
Making requests
You can paste the command below into your terminal to run your first API request. Make sure to replace $FASEEH_API_KEY with your secret API key.
curl 'https://api.faseeh.ai/api/v1/text-to-speech/faseeh-v1-preview' \
-H 'Content-Type: application/json' \
-H 'x-api-key: $FASEEH_API_KEY' \
-d '{
"voice_id": "ar-najdi-male-2",
"text": "مرحبا بك في فصيح",
"stability": 0.5,
"streaming": true,
"speed": 1
}'
Example with Python:
import requests
headers = {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.post(
'https://api.faseeh.ai/api/v1/text-to-speech/faseeh-v1-preview',
headers=headers,
json={
'voice_id': 'ar-najdi-male-2',
'text': 'مرحبا بك في فصيح',
'stability': 0.5,
'streaming': True,
'speed': 1
}
)
Example with Node.js:
const response = await fetch('https://api.faseeh.ai/api/v1/text-to-speech/faseeh-v1-preview', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
voice_id: 'ar-najdi-male-2',
text: 'مرحبا بك في فصيح',
stability: 0.5,
streaming: true,
speed: 1
})
});