curl --request POST \
--url https://api.osvi.ai/v1/campaigns/{id}/contacts \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"contacts": [
{
"person_name": "Ravi Kumar",
"phone": "9876543210",
"plan": "Pro"
},
{
"person_name": "Anita Desai",
"phone": "+919876500000"
}
],
"enqueue": true
}
'import requests
url = "https://api.osvi.ai/v1/campaigns/{id}/contacts"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"contacts": [
{
"person_name": "Ravi Kumar",
"phone": "9876543210",
"plan": "Pro"
},
{
"person_name": "Anita Desai",
"phone": "+919876500000"
}
],
"enqueue": True
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
contacts: [
{person_name: 'Ravi Kumar', phone: '9876543210', plan: 'Pro'},
{person_name: 'Anita Desai', phone: '+919876500000'}
],
enqueue: true
})
};
fetch('https://api.osvi.ai/v1/campaigns/{id}/contacts', 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.osvi.ai/v1/campaigns/{id}/contacts",
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([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'contacts' => [
[
'person_name' => 'Ravi Kumar',
'phone' => '9876543210',
'plan' => 'Pro'
],
[
'person_name' => 'Anita Desai',
'phone' => '+919876500000'
]
],
'enqueue' => true
]),
CURLOPT_HTTPHEADER => [
"API-Token: <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.osvi.ai/v1/campaigns/{id}/contacts"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<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.osvi.ai/v1/campaigns/{id}/contacts")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/v1/campaigns/{id}/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"campaign_upload_id": 19,
"contacts_received": 2,
"contacts_accepted": 2,
"duplicates_removed": 0,
"enqueued": true,
"queued_calls": 2,
"dnd_skipped": [
{}
]
}
}{
"success": false,
"error": "contacts[0]: invalid phone. Provide a 10-digit mobile number (starting with 6–9) or +91 followed by 10 digits.",
"details": null
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"error": "agent_not_found",
"details": null
}{
"success": false,
"error": "No outbound SIP configuration found for this agent. Please configure an outbound trunk before enqueueing contacts.",
"details": null
}Add Campaign Contacts
Pushes a list of contacts into a campaign, replacing manual CSV uploads. Phone numbers are normalized (Indian formats accepted), duplicates are removed (keeping the longer person_name), and any extra keys on a contact are preserved as prompt variables for the agent. Set enqueue: true to release the contacts to the agent’s calling queue immediately; the agent must have an active outbound trunk configured.
curl --request POST \
--url https://api.osvi.ai/v1/campaigns/{id}/contacts \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"contacts": [
{
"person_name": "Ravi Kumar",
"phone": "9876543210",
"plan": "Pro"
},
{
"person_name": "Anita Desai",
"phone": "+919876500000"
}
],
"enqueue": true
}
'import requests
url = "https://api.osvi.ai/v1/campaigns/{id}/contacts"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"contacts": [
{
"person_name": "Ravi Kumar",
"phone": "9876543210",
"plan": "Pro"
},
{
"person_name": "Anita Desai",
"phone": "+919876500000"
}
],
"enqueue": True
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
contacts: [
{person_name: 'Ravi Kumar', phone: '9876543210', plan: 'Pro'},
{person_name: 'Anita Desai', phone: '+919876500000'}
],
enqueue: true
})
};
fetch('https://api.osvi.ai/v1/campaigns/{id}/contacts', 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.osvi.ai/v1/campaigns/{id}/contacts",
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([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'contacts' => [
[
'person_name' => 'Ravi Kumar',
'phone' => '9876543210',
'plan' => 'Pro'
],
[
'person_name' => 'Anita Desai',
'phone' => '+919876500000'
]
],
'enqueue' => true
]),
CURLOPT_HTTPHEADER => [
"API-Token: <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.osvi.ai/v1/campaigns/{id}/contacts"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<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.osvi.ai/v1/campaigns/{id}/contacts")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/v1/campaigns/{id}/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"contacts\": [\n {\n \"person_name\": \"Ravi Kumar\",\n \"phone\": \"9876543210\",\n \"plan\": \"Pro\"\n },\n {\n \"person_name\": \"Anita Desai\",\n \"phone\": \"+919876500000\"\n }\n ],\n \"enqueue\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"campaign_upload_id": 19,
"contacts_received": 2,
"contacts_accepted": 2,
"duplicates_removed": 0,
"enqueued": true,
"queued_calls": 2,
"dnd_skipped": [
{}
]
}
}{
"success": false,
"error": "contacts[0]: invalid phone. Provide a 10-digit mobile number (starting with 6–9) or +91 followed by 10 digits.",
"details": null
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"error": "agent_not_found",
"details": null
}{
"success": false,
"error": "No outbound SIP configuration found for this agent. Please configure an outbound trunk before enqueueing contacts.",
"details": null
}Authorizations
16-character API token associated with your OSVI account. Find it in your dashboard under Settings → API.
Path Parameters
The campaign's numeric id.
Body
The agent that will place the calls.
"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og"
Up to 10,000 contacts per request. Split larger imports across multiple requests.
Show child attributes
Show child attributes
Release the contacts to the calling queue immediately.
false
