Skip to main content
GET
/
voice_designs
/
{id}
/
sample
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.voiceDesigns.downloadSample('id');

console.log(response);

const content = await response.blob();
console.log(content);
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
)
response = client.voice_designs.download_sample(
    id="id",
)
print(response)
content = response.read()
print(content)
package main

import (
	"context"
	"fmt"

	"github.com/team-telnyx/telnyx-go"
	"github.com/team-telnyx/telnyx-go/option"
)

func main() {
	client := telnyx.NewClient(
		option.WithAPIKey("My API Key"),
	)
	response, err := client.VoiceDesigns.DownloadSample(
		context.TODO(),
		"id",
		telnyx.VoiceDesignDownloadSampleParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.core.http.HttpResponse;
import com.telnyx.sdk.models.voicedesigns.VoiceDesignDownloadSampleParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        TelnyxClient client = TelnyxOkHttpClient.fromEnv();

        HttpResponse response = client.voiceDesigns().downloadSample("id");
    }
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.voice_designs.download_sample("id")

puts(response)
telnyx voice-designs download-sample \
  --api-key 'My API Key' \
  --id id
curl --request GET \
  --url https://api.telnyx.com/v2/voice_designs/{id}/sample
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.telnyx.com/v2/voice_designs/{id}/sample",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
"<string>"
{
  "errors": [
    {
      "code": "10005",
      "title": "Resource not found",
      "detail": "Voice design not found"
    }
  ]
}
{
  "errors": [
    {
      "code": "10005",
      "title": "Resource not found",
      "detail": "Voice design not found"
    }
  ]
}

Path Parameters

id
string
required

The voice design UUID or name.

Query Parameters

version
integer

Specific version number to download the sample for. Defaults to the latest version.

Required range: x >= 1

Response

WAV audio sample binary.

The response is of type file.