Building Blocks / Voice
Voice Clone (Mimic AI)
Clone a voice from a recording you have permission to use.
This block is the Voice clone API. The full product reference is the Voice clone API reference. This page is the short version: when to use it, one working request, and its limits. There is no widget to embed.
When to use this vs REST
This block is the REST API. Call it from your server with your API key. There is no browser widget; use Recording Studio if a user needs to record the sample in your app.
Do not rebuild
- A recorder. Recording Studio returns a media_id you can pass here.
- Consent collection from the speaker. You must have it before cloning.
Drop-in
Cloning is asynchronous: the route answers 202 and the voice appears in GET /voice/public/voices when it is ready. You need permission from the speaker. There is no browser widget for this block.
curl -X POST https://api-v2.dropcowboy.com/voice/public/voices/clone \
-H "x-key: $KEY" -H "x-secret: $SECRET" \
-H "Content-Type: application/json" \
-d '{"media_id":"5a4b3c2d-1e0f-4a9b-8c7d-6e5f4a3b2c1d","name":"Sales voice"}'
From Node on your server:
async function cloneSalesVoice() {
const job = await fetch('https://api-v2.dropcowboy.com/voice/public/voices/clone', {
method: 'POST',
headers: { 'x-key': process.env.DC_KEY, 'x-secret': process.env.DC_SECRET, 'Content-Type': 'application/json' },
body: JSON.stringify({ media_id: '5a4b3c2d-1e0f-4a9b-8c7d-6e5f4a3b2c1d', name: 'Sales voice' })
}).then(function (r) { return r.json(); });
// { voice_id, long_job_id }. The voice is usable once GET /voice/public/voices lists it.
return job.data;
}
With Twilio
Twilio's RecordingUrl needs your Twilio Account SID and Auth Token to fetch. If our media upload cannot reach it, download the file yourself and pass a public URL instead. You still need the speaker's permission.
app.post('/twilio/recording-complete', async function (req, res) {
const media = await fetch('https://api-v2.dropcowboy.com/media/public/media', {
method: 'POST',
headers: { 'x-key': process.env.DC_KEY, 'x-secret': process.env.DC_SECRET, 'Content-Type': 'application/json' },
body: JSON.stringify({ url: req.body.RecordingUrl + '.wav', name: 'Twilio call ' + req.body.CallSid })
}).then(function (r) { return r.json(); });
const job = await fetch('https://api-v2.dropcowboy.com/voice/public/voices/clone', {
method: 'POST',
headers: { 'x-key': process.env.DC_KEY, 'x-secret': process.env.DC_SECRET, 'Content-Type': 'application/json' },
body: JSON.stringify({ media_id: media.data.media_id, name: 'Cloned from ' + req.body.CallSid })
}).then(function (r) { return r.json(); });
res.sendStatus(200);
});
From a browser
Mint a site token with the media scope on your server, then call the same route with Authorization: Bearer <token>.
# On your server: trade your API key (needs numbers:write) for a site token. 1 hour max.
curl -s -X POST https://api-v2.dropcowboy.com/phone/public/embed/token \
-H "x-key: $KEY" -H "x-secret: $SECRET" \
-H "Content-Type: application/json" \
-d '{"site_id":"YOUR_SITE_ID","scope":["media"],"ttl_seconds":900}'
JS API / HTML tag
No browser widget and no HTML tag. Routes:
| Route | Body | What it does |
|---|---|---|
POST /voice/public/voices/clone |
{ media_id | sample_url, name } |
Starts a clone from a stored recording or a public URL. Answers 202. Scope media:write. |
POST /voice/public/voices/design |
{ instructions, text, name } |
Designs a new voice from a description instead of a recording. Answers 202. Scope media:write. |
POST /media/public/media |
{ url, name } |
Stores a recording first so you have a media_id. Scope media:write. |
Auth and scopes
API key and secret on your server (media:write). From a browser, send Authorization: Bearer with a site token minted with the media scope.
Site token scope: media. Mint it with POST https://api-v2.dropcowboy.com/phone/public/embed/token using an API key with numbers:write. Tokens last up to one hour.
Limits
- Cloning is asynchronous. The route answers 202 and the voice shows up in GET /voice/public/voices when ready.
- sample_url downloads are limited to 50 MB and 15 seconds.
- You need permission from the person whose voice you clone.
- Saved voices past the first are billed monthly. DELETE /voice/public/voices/{voice_id} removes one you no longer need.
Related REST
Routes are on https://api-v2.dropcowboy.com.
- Voice clone API reference - full reference
- POST /voice/public/voices/clone
- DELETE /voice/public/voices/{voice_id}
- POST /voice/public/voices/design
- POST /media/public/media
Full reference: Media API.