Skip to main content
POST
/
voice-changer
/
bytes
Voice Changer (Bytes)
curl --request POST \
  --url https://api.cartesia.ai/voice-changer/bytes \
  --header 'Authorization: Bearer <token>' \
  --header 'Cartesia-Version: <cartesia-version>' \
  --header 'Content-Type: multipart/form-data' \
  --form clip='@example-file' \
  --form 'voice[id]=<string>' \
  --form 'output_format[bit_rate]=123'
import requests

url = "https://api.cartesia.ai/voice-changer/bytes"

files = { "clip": ("example-file", open("example-file", "rb")) }
payload = {
"voice[id]": "<string>",
"output_format[bit_rate]": "123"
}
headers = {
"Cartesia-Version": "<cartesia-version>",
"Authorization": "Bearer <token>"
}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('clip', '<string>');
form.append('voice[id]', '<string>');
form.append('output_format[bit_rate]', '123');

const options = {
method: 'POST',
headers: {'Cartesia-Version': '<cartesia-version>', Authorization: 'Bearer <token>'}
};

options.body = form;

fetch('https://api.cartesia.ai/voice-changer/bytes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cartesia.ai/voice-changer/bytes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"clip\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice%5Bid%5D\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_format%5Bbit_rate%5D\"\r\n\r\n123\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Cartesia-Version: <cartesia-version>",
"Content-Type: multipart/form-data"
],
]);

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

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.cartesia.ai/voice-changer/bytes"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"clip\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice%5Bid%5D\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_format%5Bbit_rate%5D\"\r\n\r\n123\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Cartesia-Version", "<cartesia-version>")
req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.cartesia.ai/voice-changer/bytes")
.header("Cartesia-Version", "<cartesia-version>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"clip\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice%5Bid%5D\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_format%5Bbit_rate%5D\"\r\n\r\n123\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cartesia.ai/voice-changer/bytes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Cartesia-Version"] = '<cartesia-version>'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"clip\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice%5Bid%5D\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_format%5Bbit_rate%5D\"\r\n\r\n123\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
"<string>"

Authorizations

Authorization
string
header
required

Cartesia API key (sk_car_...). Get one at play.cartesia.ai/keys.

Headers

Cartesia-Version
enum<string>
default:2026-03-01
required

API version header.

Available options:
2026-03-01
Example:

"2026-03-01"

Body

multipart/form-data
clip
file

Supported audio formats: flac, mp3, mpeg, mpga, oga, ogg, wav, webm

voice[id]
string
output_format[container]
enum<string>
Available options:
raw,
wav,
mp3
output_format[sample_rate]
enum<integer>
Available options:
8000,
16000,
22050,
24000,
44100,
48000
output_format[encoding]
enum<string> | null

Required for raw and wav containers.

Available options:
pcm_f32le,
pcm_s16le,
pcm_mulaw,
pcm_alaw
output_format[bit_rate]
integer | null

Required for mp3 containers.

Response

200 - audio/*

Audio bytes

The response is of type file.