Text-to-Speech

Turn text into an audio file with one of your voices. Use it to preview a script, to cache audio you will play many times, or to produce files for another system.

You do not need this route to send a spoken message. The send routes accept tts_body and voice_id and synthesize on the fly. See Messaging.

Pick a voice

curl "https://api-v2.dropcowboy.com/voice/public/voices?include_urls=true" \
  -H "x-key: $DROPCOWBOY_KEY" -H "x-secret: $DROPCOWBOY_SECRET"
{
  "data": {
    "voices": [
      {
        "voice_id": "7d2a9e4b-1c6f-4b3a-8e5d-2f9c7a1b4e63",
        "team_id": "3f6c2a1e-8b4d-4c7a-9e2f-5a1b3c4d6e7f",
        "name": "Jordan (cloned)",
        "type": null,
        "gender": "female",
        "status": "ready",
        "pro_voice": false,
        "url": null,
        "created_at": 1774041600000,
        "failed_at": null
      }
    ],
    "total": 1
  },
  "meta": { "request_id": "c2a6e8f4-3b9d-4c1e-8a7f-5d3b1e9c6a24" }
}

The list holds your cloned and designed voices, plus the platform catalog unless you pass include_pro_voices=false. Catalog voices have a null team_id. Only voices with status: "ready" can speak, catalog voices included. The other states are processing (a clone still being built; poll until ready), failed (the clone did not finish) and pending_payment (buy the voice slot in the dashboard). data.total counts your account's voices, not the catalog. Scope: media:read. To remove one of your voices, see Delete a voice.

Synthesize

POST /voice/public/tts/synthesize · scope voice:send

curl https://api-v2.dropcowboy.com/voice/public/tts/synthesize \
  -H "x-key: $DROPCOWBOY_KEY" -H "x-secret: $DROPCOWBOY_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_id": "7d2a9e4b-1c6f-4b3a-8e5d-2f9c7a1b4e63",
    "text": "Thanks for calling Example Dental. How can I help?"
  }'
{
  "data": {
    "audio_url": "https://media.example.com/tts/1b7e3c9a.mp3",
    "expires_at": 1774045200000,
    "tts_characters": 50,
    "content_type": "audio/mpeg"
  },
  "meta": { "request_id": "c2a6e8f4-3b9d-4c1e-8a7f-5d3b1e9c6a24" }
}
Field Notes
voice_id Required. Any voice the list shows as ready: yours or the catalog's.
text Required. tts_body is accepted as an alias.
language Optional hint, for example en.

The call is synchronous. audio_url is valid for about an hour, so download the file if you need it after expires_at (epoch milliseconds). Billing is per character, and the response reports the billed count in tts_characters.

Errors

Status Cause
400 Missing voice_id or text.
402 No funds, or the voice is still awaiting checkout (pending_payment). type ends payment-required.
404 The voice does not exist, was deleted, or belongs to another account.
409 The voice is still processing or failed. type ends voice-not-ready.

See Errors and limits for the error format.

Code samples

The requests from this page, ready to copy. Set DC_KEY and DC_SECRET to your API key pair first.

Pick a voice
curl "https://api-v2.dropcowboy.com/voice/public/voices?include_urls=true" \
  -H "x-key: $DROPCOWBOY_KEY" -H "x-secret: $DROPCOWBOY_SECRET"
Synthesize
curl https://api-v2.dropcowboy.com/voice/public/tts/synthesize \
  -H "x-key: $DROPCOWBOY_KEY" -H "x-secret: $DROPCOWBOY_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_id": "7d2a9e4b-1c6f-4b3a-8e5d-2f9c7a1b4e63",
    "text": "Thanks for calling Example Dental. How can I help?"
  }'