API Reference
Authentication
API key authentication for ProsodyAI
Authentication
All ProsodyAI API requests require authentication using an API key.
Obtaining an API Key
- Sign in to the ProsodyAI Dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Copy and securely store the key (it's only shown once)
API Key Format
API keys use the format psk_ followed by a secure random string:
psk_a1b2c3d4e5f6g7h8i9j0...Security: API keys grant full access to your account. Never expose them in client-side code, commit them to version control, or share them publicly.
Authentication Methods
Bearer Token (Recommended)
curl https://api.prosody.ai/v1/analyze \
-H "Authorization: Bearer psk_your_api_key"X-API-Key Header
curl https://api.prosody.ai/v1/analyze \
-H "X-API-Key: psk_your_api_key"Code Examples
curl -X POST https://api.prosody.ai/v1/analyze \
-H "Authorization: Bearer psk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"audio_url": "https://storage.example.com/audio.wav",
"vertical": "contact_center"
}'const response = await fetch('https://api.prosody.ai/v1/analyze', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.PROSODY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
audio_url: 'https://storage.example.com/audio.wav',
vertical: 'contact_center',
}),
});
const result = await response.json();import requests
import os
response = requests.post(
'https://api.prosody.ai/v1/analyze',
headers={
'Authorization': f'Bearer {os.environ["PROSODY_API_KEY"]}',
'Content-Type': 'application/json',
},
json={
'audio_url': 'https://storage.example.com/audio.wav',
'vertical': 'contact_center',
},
)
result = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
"os"
)
func main() {
payload := map[string]string{
"audio_url": "https://storage.example.com/audio.wav",
"vertical": "contact_center",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.prosody.ai/v1/analyze", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("PROSODY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}API Key Management
List Keys
curl https://api.prosody.ai/v1/api-keys \
-H "Authorization: Bearer psk_your_api_key"Response:
{
"api_keys": [
{
"id": "key_abc123",
"name": "Production",
"prefix": "psk_a1b2c3",
"created_at": "2025-01-15T10:30:00Z",
"last_used_at": "2025-02-20T14:22:00Z",
"expires_at": null,
"rate_limit": 1000
}
]
}Create Key
curl -X POST https://api.prosody.ai/v1/api-keys \
-H "Authorization: Bearer psk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Staging Environment",
"expires_at": "2026-01-01T00:00:00Z",
"rate_limit": 500
}'Response:
{
"api_key": {
"id": "key_xyz789",
"key": "psk_newkey...",
"name": "Staging Environment",
"created_at": "2025-02-22T12:00:00Z"
},
"message": "Save this key now - it will not be shown again."
}Revoke Key
curl -X DELETE https://api.prosody.ai/v1/api-keys/key_xyz789 \
-H "Authorization: Bearer psk_your_api_key"Key Configuration
| Option | Type | Description |
|---|---|---|
name | string | Human-readable name |
expires_at | ISO 8601 | Expiration timestamp (optional) |
rate_limit | number | Custom rate limit (requests/min) |
Security Best Practices
- Rotate keys regularly - Create new keys and revoke old ones periodically
- Use environment variables - Never hardcode keys in source code
- Separate keys per environment - Use different keys for dev/staging/production
- Set expiration dates - For temporary access or contractor keys
- Monitor usage - Review last_used_at to detect compromised keys
Troubleshooting
401 Unauthorized
{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key"
}
}Causes:
- Missing
Authorizationheader - Invalid API key
- Expired API key
- Revoked API key
403 Forbidden
{
"error": {
"code": "forbidden",
"message": "API key does not have permission for this resource"
}
}Causes:
- Key doesn't have required permissions
- Attempting to access another organization's resources