Back to site
ProsodyAI Docs
API Reference

Authentication

API key authentication for ProsodyAI

Authentication

All ProsodyAI API requests require authentication using an API key.

Obtaining an API Key

  1. Sign in to the ProsodyAI Dashboard
  2. Navigate to Settings → API Keys
  3. Click Create API Key
  4. 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

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

OptionTypeDescription
namestringHuman-readable name
expires_atISO 8601Expiration timestamp (optional)
rate_limitnumberCustom rate limit (requests/min)

Security Best Practices

  1. Rotate keys regularly - Create new keys and revoke old ones periodically
  2. Use environment variables - Never hardcode keys in source code
  3. Separate keys per environment - Use different keys for dev/staging/production
  4. Set expiration dates - For temporary access or contractor keys
  5. Monitor usage - Review last_used_at to detect compromised keys

Troubleshooting

401 Unauthorized

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key"
  }
}

Causes:

  • Missing Authorization header
  • 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