API reference / More
Test on retail, then go live on BYOC
This guide gets your integration working on a retail account before your own carrier is connected, then moves it to bring-your-own-carrier (BYOC) without changing your code. You test against your own phones, read real results, and keep the same request body when you go live.
Send only to people who agreed to hear from you. See Consent.
A
202means queued, not sent. The result of each voicemail arrives on thecontact.rvm.statuswebhook and on yourcallback_urlwhen the send has one. Search themessage_idon Settings > API Logs (Delivery column), or open Campaigns, where API send history is shown by default.
How it works
- Testing mode. Support turns it on for your account. While it's on,
ringless voicemail and voice broadcast sends go only to your test numbers.
A send to any other number fails with
3040(Test Numbers Only). - A body that works on both plans. Send
phone_line_idand exactly one audio source. Don't sendcaller_id: retail accounts ignore it, and on BYOC the phone line wins over it. - Phone lines are kept. Connecting your carrier releases the numbers you
rent from Drop Cowboy® but keeps your phone lines. You import your own numbers
onto the same line, so the same
phone_line_idkeeps working.
audio_url is available on BYOC plans only and must be enabled by support.
Contact support to enable it. If you're testing on a retail account before
connecting your carrier, support can enable it for testing; while testing,
voice sends go only to your test numbers. Otherwise, upload your file and send
media_id, or use text to speech. media_id and text to speech work on both
plans, so they're the safest choice for a body you won't change.
Before you start
| You need | Details | Where to get it |
|---|---|---|
| A retail account | Any Drop Cowboy plan without your own carrier | Quickstart |
| API key scopes | rvm:send, numbers:read, media:write, balance:read. Later, account:write and numbers:write to connect the carrier and import numbers. |
Authentication |
| Phones you own | Numbers in E.164 to use as test numbers | Your own phones |
| Somewhere for results | A public HTTPS URL that accepts POST and answers 200 quickly |
Receive results |
| Your carrier account | Its credentials, for when you go live | Your carrier's portal |
1. Ask support for testing mode
Contact support and ask for testing mode while you move to your own carrier.
Ask for audio_url too if you plan to send hosted audio.
2. Add your test numbers
Add the phones you own as test numbers on the Dialing rules page in the dashboard. They also skip the contact frequency limit. Calling hours still apply unless you turn on Allow Test Numbers to Bypass TCPA Hours on that page. See Test numbers.
Check what your account allows:
curl https://api-v2.dropcowboy.com/register/public/integration-readiness \
-H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"
The response is trimmed to the three fields that matter here:
{
"data": {
"audio_url_allowed": true,
"test_numbers_only": true,
"test_numbers": ["+13125550142", "+13125550143"]
}
}
test_numbers_only: true means testing mode is on, and test_numbers lists
the only numbers voice sends can reach. audio_url_allowed says whether
audio_url is enabled. See
Check Building Blocks readiness.
3. Pick the phone line
curl "https://api-v2.dropcowboy.com/phone/public/lines?type=voice" \
-H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"
Each line's ivr_id is the phone_line_id you send. Store it in
DC_PHONE_LINE_ID. Pick the line you want your own numbers on later. See
Phone numbers.
4. Add the audio
Add the file to your media library and keep the media_id from the response.
Store it in DC_MEDIA_ID. Either way needs the media:write scope:
- Upload the bytes. Create the entry with
signed_upload: true,PUTthe file toupload.mp3.urlorupload.wav.urlwith exactly thecontent_typereturned next to it, then complete the upload. See Signed upload. - Import from a URL. Send
name,urlandext, and the file is ready when the call returns. See From a URL.
To have a voice read your text instead, send tts_body and voice_id. See
Send a ringless voicemail with text to speech.
5. Send to a test number
This builds the body from your environment, so it never carries a sample id.
It needs jq, and stops with a message when a
variable is unset.
: "${DC_TO:?Set DC_TO to one of your test numbers, in E.164}"
: "${DC_PHONE_LINE_ID:?Set DC_PHONE_LINE_ID to an ivr_id from GET /phone/public/lines}"
: "${DC_MEDIA_ID:?Set DC_MEDIA_ID to the media_id from the upload or import response}"
: "${DC_CALLBACK_URL:?Set DC_CALLBACK_URL to a public https URL on your server}"
jq -n --arg to "$DC_TO" --arg line "$DC_PHONE_LINE_ID" \
--arg media "$DC_MEDIA_ID" --arg cb "$DC_CALLBACK_URL" \
'{to: $to, phone_line_id: $line, media_id: $media, callback_url: $cb}' |
curl -X POST https://api-v2.dropcowboy.com/rvm \
-H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
--data-binary @-
The body it sends looks like this. The ids here are placeholders; yours are the
ivr_id from step 3 and the media_id from step 4:
{
"to": "+13125550142",
"phone_line_id": "e2b6f9a3-5c1d-4e8b-a4f7-9c3e1b5d7a28",
"media_id": "1b7e3c9a-4d2f-4a8b-9e6c-7f2a1d5b3c80",
"callback_url": "https://your-server.example.com/dropcowboy/rvm-result"
}
It answers 202 with { "status": "queued", "message_id": "..." }. Keep this
body as it is. It's the one you'll send in production.
6. Check the outcome
Every send produces one outcome. Look for it in three places:
- Signed webhooks. The way to receive results in production. Subscribe to
contact.rvm.status, and tocontact.rvm.receiptfor proof of delivery. VerifyX-Signature(sha256=and the hex HMAC ofX-Timestamp, a., and the raw body) and reject a timestamp more than 300 seconds old. See Verify the signature. - Your
callback_url. The examples pass one so each test run reports to its own address. One unsignedPOST, tried once with a 10-second timeout. Any answer other than2xx, such as404, is final, so make the route acceptPOSTand answer200before doing any work. - API send history. Open Campaigns (Show API send history is on by default). The API entry lists each send with its result. See Where results arrive.
- Settings > API Logs. Search the
message_id. Status is whether the send was accepted; Delivery is the later result. See Find a request.
A reason_code of 0 means the voicemail was left. While you test, expect
these too:
reason_code |
Meaning | What to do |
|---|---|---|
3040 |
The number isn't one of your test numbers | Add it on the Dialing rules page, or send to one that is |
3014 |
audio_url isn't enabled, or no audio was given |
Send media_id or text to speech, or ask support to enable audio_url |
3001 |
The media_id isn't on your account |
Use the media_id from your own upload or import |
3013 |
phone_line_id isn't one of your lines |
Use an ivr_id from step 3 |
Every code is in Outcomes.
7. Connect your carrier
When your tests pass, connect your carrier with
POST /integration/public/byoc/connect and confirm_leave_retail: true. This
moves the account to a BYOC plan and releases the numbers you rent from Drop
Cowboy. Your phone lines stay. Read
The plan change before you call
it.
8. Import your numbers onto the same phone line
Load the numbers you hold at your carrier onto the line from step 3:
curl -X POST https://api-v2.dropcowboy.com/phone/public/numbers/import \
-H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg line "$DC_PHONE_LINE_ID" \
'{phone_numbers: ["+13125550100", "+13125550101"], phone_line_id: $line}')"
Replace the two numbers with ones you hold at your carrier. The route answers
202 with a long_job_id. Poll
GET /phone/public/numbers/import/{job_id} until status is completed.
To take calls back on these numbers, point your trunk at Drop Cowboy as in
Receive calls on your own numbers.
9. Go live
Nothing changes in your code. The same body from step 5 now goes out on your
carrier, from your own numbers on the line. Once
GET /register/public/integration-readiness shows test_numbers_only: false,
send to any number that agreed to hear from you. If it still shows true,
ask support to end testing mode.
If it does not work
| You see | Likely cause | Fix |
|---|---|---|
202, but no outcome reaches you |
Your endpoint isn't answering POST with 2xx |
Check Settings > API Logs. See I got a 202 but nothing happened. |
403 on the media PUT |
The Content-Type differs from the returned content_type, or the URL expired |
See 403 when uploading media |
3040 after going live |
Testing mode is still on | Ask support to end it |
4010 |
No phone_line_id, and no default line |
Send phone_line_id |
More symptoms are in Troubleshooting.