Skip to main content
This walks through the common path: add contacts to a list, create an SMS campaign against it, and start sending. Replace as_live_… with your key.
1

Add a contact to a list

Upsert contacts by phone. The list is created if it doesn’t exist; the response includes its list_id.
curl -X POST https://astrasend-mocha.vercel.app/api/public/contacts \
  -H "Authorization: Bearer as_live_…" \
  -H "Content-Type: application/json" \
  -d '{"contacts":[{"phone":"+15551234567","first_name":"Jo"}],"list":"API leads"}'
{ "ok": true, "imported": 1, "skipped": 0, "list_id": "8f3c…" }
2

Find a sending number

List your numbers and grab an id to send from.
curl https://astrasend-mocha.vercel.app/api/public/numbers \
  -H "Authorization: Bearer as_live_…"
3

Create the campaign

Pass the list_id and a number_id. The campaign is built but not yet sending.
curl -X POST https://astrasend-mocha.vercel.app/api/public/campaigns \
  -H "Authorization: Bearer as_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome blast",
    "message": "Hi {{first_name}}, welcome! Reply STOP to opt out.",
    "list_id": "8f3c…",
    "number_id": "1a2b…"
  }'
{ "ok": true, "campaign": { "campaignId": "c_…", "audienceCount": 1, "status": "ready" } }
4

Start sending

curl -X POST https://astrasend-mocha.vercel.app/api/public/campaigns/c_…/start \
  -H "Authorization: Bearer as_live_…"

Send a one-off SMS

Skip campaigns entirely for transactional messages:
curl -X POST https://astrasend-mocha.vercel.app/api/public/messages \
  -H "Authorization: Bearer as_live_…" \
  -H "Content-Type: application/json" \
  -d '{"to":"+15551234567","body":"Your code is 4821."}'

Create a voice agent + voice campaign

# 1. Pick a voice
curl https://astrasend-mocha.vercel.app/api/public/voices -H "Authorization: Bearer as_live_…"

# 2. Create the agent
curl -X POST https://astrasend-mocha.vercel.app/api/public/agents \
  -H "Authorization: Bearer as_live_…" -H "Content-Type: application/json" \
  -d '{"name":"Booking bot","channel":"voice","system_prompt":"You book callbacks for Acme.","greeting":"Hi, this is Acme!","voice_id":"voice_abc"}'

# 3. Create + start a voice campaign (number_id is the caller ID)
curl -X POST https://astrasend-mocha.vercel.app/api/public/campaigns \
  -H "Authorization: Bearer as_live_…" -H "Content-Type: application/json" \
  -d '{"type":"voice","name":"Callbacks","list_id":"8f3c…","voice_agent_id":"ag_…","number_id":"1a2b…"}'
Campaign create/start and message send require the platform’s send infrastructure to be online. Reads (contacts, numbers, agents, campaigns) work on their own.