POST
/
api
/
v2
/
voice-clones
/
preview
curl --request POST \
  --url https://api.buena.ai/api/v2/voice-clones/preview \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "voiceId": "<string>",
  "text": "<string>"
}'
Content-Type: audio/mpeg
Content-Length: 99328
Content-Disposition: attachment; filename="preview.mp3"

Generate a preview audio sample using one of your voice clones. This allows you to test voice quality and settings before using the voice clone in LinkedIn messages or other applications.

Requires the voice:preview permission.

Request

Authorization
string
required

Bearer token with your API key that has voice:preview permission (e.g., “Bearer bna-your-api-key”)

Content-Type
string
required

Must be application/json

Body Parameters

voiceId
string
required

The ID of the voice clone to use for preview generation

text
string
required

Text to synthesize into speech (1-500 characters)

Examples

Basic Voice Preview

curl -X POST "https://api.buena.ai/api/v2/voice-clones/preview" \
  -H "Authorization: Bearer bna-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "voiceId": "pNInz6obpgDQGcFmaJgB",
    "text": "Hello! This is a test of my voice clone. How does it sound?"
  }' \
  --output preview.mp3

Advanced Preview with Custom Settings

curl -X POST "https://api.buena.ai/api/v2/voice-clones/preview" \
  -H "Authorization: Bearer bna-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "voiceId": "pNInz6obpgDQGcFmaJgB",
    "text": "This is a test with my voice clone for maximum clarity and stability."
  }' \
  --output preview.mp3

Response

The response is the audio file binary data with Content-Type: audio/mpeg

No JSON response is returned - the endpoint streams the audio file directly for immediate playback or download.

Content-Type: audio/mpeg
Content-Length: 99328
Content-Disposition: attachment; filename="preview.mp3"

Preview Guidelines

Text Recommendations

Voice Settings Optimization

SettingLow (0.0-0.3)Medium (0.4-0.7)High (0.8-1.0)
StabilityMore expressive, variableBalanced expressionVery consistent, robotic
ClarityMore natural, may varyGood balanceMaximum similarity, clear
Speaker BoostDisabled-Enabled
{
  "linkedin_professional": {
    "stability": 0.6,
    "clarity": 0.8,
    "use_speaker_boost": true
  },
  "sales_energetic": {
    "stability": 0.4,
    "clarity": 0.7,
    "use_speaker_boost": true
  },
  "casual_friendly": {
    "stability": 0.5,
    "clarity": 0.6,
    "use_speaker_boost": false
  }
}

Error Responses

Voice Clone Not Found (404)

{
  "success": false,
  "error": "Voice not found or not accessible",
  "details": "The specified voice ID does not exist or you don't have access to it"
}

Text Too Long (400)

{
  "success": false,
  "error": "Text too long",
  "details": "Text exceeds maximum length of 500 characters"
}

Voice Generation Failed (500)

{
  "success": false,
  "error": "Voice generation failed",
  "details": "Failed to generate voice preview. Please try again."
}

Integration Examples

Voice Quality Testing Workflow

async function testVoiceQuality(voiceId) {
  const testTexts = [
    "Hello, this is a quick test.",
    "Hi there! I hope you're having a fantastic day. I wanted to reach out because I saw your impressive work at your company.",
    "I'm excited about this opportunity and would love to discuss it further. When might be a good time to chat?",
  ];

  const results = [];

  for (const text of testTexts) {
    try {
      const response = await fetch(
        "https://api.buena.ai/api/v2/voice-clones/preview",
        {
          method: "POST",
          headers: {
            Authorization: "Bearer bna-your-api-key",
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            voiceId: voiceId,
            text: text,
          }),
        }
      );

      const audioBlob = await response.blob();
      const audioUrl = URL.createObjectURL(audioBlob);

      results.push({
        text: text,
        audioUrl: audioUrl,
        size: audioBlob.size,
      });

      console.log(`✅ Generated preview for: "${text.substring(0, 30)}..."`);
    } catch (error) {
      console.error(`❌ Failed to generate preview: ${error.message}`);
    }
  }

  return results;
}

Next Steps