Skip to content

Getting started

Send your first VoiceLab request with a server-side API key.

Use the VoiceLab API

  1. Create an API key

    Create a key in the VoiceLab app, copy it once, and store it as a managed secret.

    dotenv
    VOICELAB_API_KEY=vlk_your_secret

    Send it in the authorization header:

    http
    Authorization: Bearer vlk_your_secret

    Never put a long-lived key in frontend code, a mobile app, logs, or a URL. See Authentication and API keys for permissions and rotation.

  2. Choose a voice

    Fetch the current language and voice catalogs. Do not hardcode them.

    bash
    curl -fS 'https://api.voicelab.uz/v1/tts/languages' \
      -H "Authorization: Bearer $VOICELAB_API_KEY"
    
    curl -fS 'https://api.voicelab.uz/v1/voices?language=en' \
      -H "Authorization: Bearer $VOICELAB_API_KEY"

    Use a returned voice_... ID in the next request.

  3. Generate speech

    bash
    curl -fS 'https://api.voicelab.uz/v1/tts' \
      -H "Authorization: Bearer $VOICELAB_API_KEY" \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: getting-started-0001' \
      -d '{
        "text": "Hello from VoiceLab.",
        "language": "en",
        "voice_id": "voice_01J9NEUTRAL0000000000000001",
        "speed": 1
      }' \
      -o hello.wav

    200 OK returns mono, 16-bit PCM WAV audio at 24 kHz. Retry a timeout with the same idempotency key and body.

  4. Transcribe audio

    bash
    curl -fS 'https://api.voicelab.uz/v1/stt' \
      -H "Authorization: Bearer $VOICELAB_API_KEY" \
      -H 'Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000' \
      -F 'audio=@meeting.mp3;type=audio/mpeg' \
      -F 'language=en' \
      -F 'include_speakers=false'

    Audio from 0.5 to 30 seconds and up to 10 MiB uses the synchronous endpoint. See the STT reference for long audio.

Next steps