curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/campaigns \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Q1 Customer Outreach",
"phoneNumber": "+14155551212",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"recipients": [
{
"phoneNumber": "+1234567890",
"ignoreE164Validation": false,
"name": "John Doe"
}
],
"sendType": "NOW",
"timeRange": {
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY"
],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"reservedConcurrency": 10
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/campaigns"
payload = {
"name": "Q1 Customer Outreach",
"phoneNumber": "+14155551212",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"recipients": [
{
"phoneNumber": "+1234567890",
"ignoreE164Validation": False,
"name": "John Doe"
}
],
"sendType": "NOW",
"timeRange": {
"days": ["MONDAY", "TUESDAY", "WEDNESDAY"],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"reservedConcurrency": 10
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Q1 Customer Outreach',
phoneNumber: '+14155551212',
voiceAgentId: '68f7656f-098b-4c43-b165-7cfd2cc8ac40',
recipients: [{phoneNumber: '+1234567890', ignoreE164Validation: false, name: 'John Doe'}],
sendType: 'NOW',
timeRange: {
days: ['MONDAY', 'TUESDAY', 'WEDNESDAY'],
startCallingTime: '09:00',
endCallingTime: '17:00'
},
scheduledDate: '2025-12-01T09:00:00Z',
scheduledTimezone: 'America/New_York',
reservedConcurrency: 10
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Q1 Customer Outreach',
'phoneNumber' => '+14155551212',
'voiceAgentId' => '68f7656f-098b-4c43-b165-7cfd2cc8ac40',
'recipients' => [
[
'phoneNumber' => '+1234567890',
'ignoreE164Validation' => false,
'name' => 'John Doe'
]
],
'sendType' => 'NOW',
'timeRange' => [
'days' => [
'MONDAY',
'TUESDAY',
'WEDNESDAY'
],
'startCallingTime' => '09:00',
'endCallingTime' => '17:00'
],
'scheduledDate' => '2025-12-01T09:00:00Z',
'scheduledTimezone' => 'America/New_York',
'reservedConcurrency' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/campaigns"
payload := strings.NewReader("{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v1/voice-agents/campaigns")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"messageKey": "CAMPAIGN_CREATED_SUCCESSFULLY",
"data": {
"id": "a8f7656f-098b-4c43-b165-7cfd2cc8ac50",
"name": "Q1 Customer Outreach",
"status": "SCHEDULED",
"sendType": "NOW",
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"timeRange": {
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY"
],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"reservedConcurrency": 10,
"webhookUrl": "https://example.com/webhook",
"projectId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"userId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"phoneNumberId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"createdAt": "2025-12-06T10:00:00.000Z",
"updatedAt": "2025-12-06T10:00:00.000Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Create Campaign
Creates a new outbound campaign with specified recipients, voice agent, and scheduling configuration.
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/campaigns \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Q1 Customer Outreach",
"phoneNumber": "+14155551212",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"recipients": [
{
"phoneNumber": "+1234567890",
"ignoreE164Validation": false,
"name": "John Doe"
}
],
"sendType": "NOW",
"timeRange": {
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY"
],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"reservedConcurrency": 10
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/campaigns"
payload = {
"name": "Q1 Customer Outreach",
"phoneNumber": "+14155551212",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"recipients": [
{
"phoneNumber": "+1234567890",
"ignoreE164Validation": False,
"name": "John Doe"
}
],
"sendType": "NOW",
"timeRange": {
"days": ["MONDAY", "TUESDAY", "WEDNESDAY"],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"reservedConcurrency": 10
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Q1 Customer Outreach',
phoneNumber: '+14155551212',
voiceAgentId: '68f7656f-098b-4c43-b165-7cfd2cc8ac40',
recipients: [{phoneNumber: '+1234567890', ignoreE164Validation: false, name: 'John Doe'}],
sendType: 'NOW',
timeRange: {
days: ['MONDAY', 'TUESDAY', 'WEDNESDAY'],
startCallingTime: '09:00',
endCallingTime: '17:00'
},
scheduledDate: '2025-12-01T09:00:00Z',
scheduledTimezone: 'America/New_York',
reservedConcurrency: 10
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Q1 Customer Outreach',
'phoneNumber' => '+14155551212',
'voiceAgentId' => '68f7656f-098b-4c43-b165-7cfd2cc8ac40',
'recipients' => [
[
'phoneNumber' => '+1234567890',
'ignoreE164Validation' => false,
'name' => 'John Doe'
]
],
'sendType' => 'NOW',
'timeRange' => [
'days' => [
'MONDAY',
'TUESDAY',
'WEDNESDAY'
],
'startCallingTime' => '09:00',
'endCallingTime' => '17:00'
],
'scheduledDate' => '2025-12-01T09:00:00Z',
'scheduledTimezone' => 'America/New_York',
'reservedConcurrency' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/campaigns"
payload := strings.NewReader("{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v1/voice-agents/campaigns")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Q1 Customer Outreach\",\n \"phoneNumber\": \"+14155551212\",\n \"voiceAgentId\": \"68f7656f-098b-4c43-b165-7cfd2cc8ac40\",\n \"recipients\": [\n {\n \"phoneNumber\": \"+1234567890\",\n \"ignoreE164Validation\": false,\n \"name\": \"John Doe\"\n }\n ],\n \"sendType\": \"NOW\",\n \"timeRange\": {\n \"days\": [\n \"MONDAY\",\n \"TUESDAY\",\n \"WEDNESDAY\"\n ],\n \"startCallingTime\": \"09:00\",\n \"endCallingTime\": \"17:00\"\n },\n \"scheduledDate\": \"2025-12-01T09:00:00Z\",\n \"scheduledTimezone\": \"America/New_York\",\n \"reservedConcurrency\": 10\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"messageKey": "CAMPAIGN_CREATED_SUCCESSFULLY",
"data": {
"id": "a8f7656f-098b-4c43-b165-7cfd2cc8ac50",
"name": "Q1 Customer Outreach",
"status": "SCHEDULED",
"sendType": "NOW",
"scheduledDate": "2025-12-01T09:00:00Z",
"scheduledTimezone": "America/New_York",
"timeRange": {
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY"
],
"startCallingTime": "09:00",
"endCallingTime": "17:00"
},
"reservedConcurrency": 10,
"webhookUrl": "https://example.com/webhook",
"projectId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"userId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"voiceAgentId": "68f7656f-098b-4c43-b165-7cfd2cc8ac40",
"phoneNumberId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"createdAt": "2025-12-06T10:00:00.000Z",
"updatedAt": "2025-12-06T10:00:00.000Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Body
Campaign name (1-100 characters).
1 - 100"Q1 Customer Outreach"
Phone number to use for the campaign in E.164 format.
"+14155551212"
Voice agent ID to use for the campaign.
"68f7656f-098b-4c43-b165-7cfd2cc8ac40"
List of recipients for the campaign (minimum 1 recipient).
1Show child attributes
Show child attributes
When to send the campaign. Use 'NOW' for immediate sending or 'SCHEDULED' for scheduled sending.
NOW, SCHEDULED "NOW"
Time range for making calls.
Show child attributes
Show child attributes
Scheduled date/time in ISO 8601 format (required when sendType is SCHEDULED).
"2025-12-01T09:00:00Z"
Timezone for scheduled campaign (required when sendType is SCHEDULED).
"America/New_York"
Number of concurrent calls reserved for this campaign (must be positive). Defaults to 1 when omitted.
x >= 110
Was this page helpful?