View Categories

Campaigns API

1 min read

Campaigns API #

Manage voice campaigns for bulk calling operations.

Create Campaign #

Endpoint: POST /api/v1/campaigns

curl -X POST "https://app.voxpria.com/api/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q1 Customer Survey",
    "agentId": "agent_abc123",
    "contacts": [
      {
        "phone": "+14155551234",
        "variables": {"name": "John"}
      },
      {
        "phone": "+14155555678",
        "variables": {"name": "Jane"}
      }
    ],
    "schedule": {
      "startTime": "2025-02-10T09:00:00Z",
      "timezone": "America/New_York"
    }
  }'

Response #

{
  "success": true,
  "data": {
    "campaignId": "campaign_xyz789",
    "name": "Q1 Customer Survey",
    "status": "scheduled",
    "totalContacts": 2,
    "createdAt": "2025-02-09T12:00:00Z"
  }
}

Get Campaign #

Endpoint: GET /api/v1/campaigns/:id

curl -X GET "https://app.voxpria.com/api/v1/campaigns/campaign_xyz789" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response #

{
  "success": true,
  "data": {
    "campaignId": "campaign_xyz789",
    "name": "Q1 Customer Survey",
    "status": "in_progress",
    "stats": {
      "total": 2,
      "completed": 1,
      "failed": 0,
      "pending": 1
    },
    "progress": 50
  }
}

List Campaigns #

Endpoint: GET /api/v1/campaigns

curl -X GET "https://app.voxpria.com/api/v1/campaigns?status=active" \
  -H "Authorization: Bearer YOUR_API_KEY"

Update Campaign #

Endpoint: PUT /api/v1/campaigns/:id

curl -X PUT "https://app.voxpria.com/api/v1/campaigns/campaign_xyz789" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "paused"
  }'

Campaign Statuses #

Status Description
draft Being created
scheduled Scheduled for future
in_progress Currently running
paused Temporarily paused
completed All calls finished
cancelled Cancelled by user

Code Example #

JavaScript #

async function createCampaign(name, agentId, contacts) {
  const response = await axios.post(
    'https://app.voxpria.com/api/v1/campaigns',
    { name, agentId, contacts },
    {
      headers: {
        'Authorization': `Bearer ${process.env.VOXPRIA_API_KEY}`
      }
    }
  );
  return response.data;
}

Python #

def create_campaign(name, agent_id, contacts):
    response = requests.post(
        'https://app.voxpria.com/api/v1/campaigns',
        json={
            'name': name,
            'agentId': agent_id,
            'contacts': contacts
        },
        headers={
            'Authorization': f'Bearer {os.getenv("VOXPRIA_API_KEY")}'
        }
    )
    return response.json()

Leave A Comment

Go to Top