Create Campaign
curl --request POST \
--url https://api.agents.timepay.ai/api/v1/campaigns/create \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"campaignType": "<string>",
"workflowId": "<string>",
"startDate": "<string>",
"startTime": "<string>",
"endDate": "<string>",
"endTime": "<string>",
"languages": [
"<string>"
],
"region": "<string>",
"tags": [
"<string>"
],
"jsonData": [
{
"loan_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"loan_amount": 123,
"emi_amount": 123,
"loan_period": 123,
"current_emi": 123,
"emi_due_date": "<string>",
"payment_status": "<string>",
"language": "<string>",
"lead_id": "<string>",
"lead_date": "<string>"
}
]
}
'import requests
url = "https://api.agents.timepay.ai/api/v1/campaigns/create"
payload = {
"name": "<string>",
"description": "<string>",
"campaignType": "<string>",
"workflowId": "<string>",
"startDate": "<string>",
"startTime": "<string>",
"endDate": "<string>",
"endTime": "<string>",
"languages": ["<string>"],
"region": "<string>",
"tags": ["<string>"],
"jsonData": [
{
"loan_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"loan_amount": 123,
"emi_amount": 123,
"loan_period": 123,
"current_emi": 123,
"emi_due_date": "<string>",
"payment_status": "<string>",
"language": "<string>",
"lead_id": "<string>",
"lead_date": "<string>"
}
]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
campaignType: '<string>',
workflowId: '<string>',
startDate: '<string>',
startTime: '<string>',
endDate: '<string>',
endTime: '<string>',
languages: ['<string>'],
region: '<string>',
tags: ['<string>'],
jsonData: [
{
loan_id: '<string>',
first_name: '<string>',
last_name: '<string>',
phone_number: '<string>',
loan_amount: 123,
emi_amount: 123,
loan_period: 123,
current_emi: 123,
emi_due_date: '<string>',
payment_status: '<string>',
language: '<string>',
lead_id: '<string>',
lead_date: '<string>'
}
]
})
};
fetch('https://api.agents.timepay.ai/api/v1/campaigns/create', 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.agents.timepay.ai/api/v1/campaigns/create",
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' => '<string>',
'description' => '<string>',
'campaignType' => '<string>',
'workflowId' => '<string>',
'startDate' => '<string>',
'startTime' => '<string>',
'endDate' => '<string>',
'endTime' => '<string>',
'languages' => [
'<string>'
],
'region' => '<string>',
'tags' => [
'<string>'
],
'jsonData' => [
[
'loan_id' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'phone_number' => '<string>',
'loan_amount' => 123,
'emi_amount' => 123,
'loan_period' => 123,
'current_emi' => 123,
'emi_due_date' => '<string>',
'payment_status' => '<string>',
'language' => '<string>',
'lead_id' => '<string>',
'lead_date' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.agents.timepay.ai/api/v1/campaigns/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.agents.timepay.ai/api/v1/campaigns/create")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.timepay.ai/api/v1/campaigns/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"data": {
"id": "camp_abc123",
"name": "Debt Collection Q1"
}
}
{
"success": false,
"error": "ValidationError",
"message": "Missing required field: workflowId"
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}
Campaigns
Create Campaign
Create a new campaign with configuration and customer records.
Create Campaign
curl --request POST \
--url https://api.agents.timepay.ai/api/v1/campaigns/create \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"campaignType": "<string>",
"workflowId": "<string>",
"startDate": "<string>",
"startTime": "<string>",
"endDate": "<string>",
"endTime": "<string>",
"languages": [
"<string>"
],
"region": "<string>",
"tags": [
"<string>"
],
"jsonData": [
{
"loan_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"loan_amount": 123,
"emi_amount": 123,
"loan_period": 123,
"current_emi": 123,
"emi_due_date": "<string>",
"payment_status": "<string>",
"language": "<string>",
"lead_id": "<string>",
"lead_date": "<string>"
}
]
}
'import requests
url = "https://api.agents.timepay.ai/api/v1/campaigns/create"
payload = {
"name": "<string>",
"description": "<string>",
"campaignType": "<string>",
"workflowId": "<string>",
"startDate": "<string>",
"startTime": "<string>",
"endDate": "<string>",
"endTime": "<string>",
"languages": ["<string>"],
"region": "<string>",
"tags": ["<string>"],
"jsonData": [
{
"loan_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"loan_amount": 123,
"emi_amount": 123,
"loan_period": 123,
"current_emi": 123,
"emi_due_date": "<string>",
"payment_status": "<string>",
"language": "<string>",
"lead_id": "<string>",
"lead_date": "<string>"
}
]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
campaignType: '<string>',
workflowId: '<string>',
startDate: '<string>',
startTime: '<string>',
endDate: '<string>',
endTime: '<string>',
languages: ['<string>'],
region: '<string>',
tags: ['<string>'],
jsonData: [
{
loan_id: '<string>',
first_name: '<string>',
last_name: '<string>',
phone_number: '<string>',
loan_amount: 123,
emi_amount: 123,
loan_period: 123,
current_emi: 123,
emi_due_date: '<string>',
payment_status: '<string>',
language: '<string>',
lead_id: '<string>',
lead_date: '<string>'
}
]
})
};
fetch('https://api.agents.timepay.ai/api/v1/campaigns/create', 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.agents.timepay.ai/api/v1/campaigns/create",
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' => '<string>',
'description' => '<string>',
'campaignType' => '<string>',
'workflowId' => '<string>',
'startDate' => '<string>',
'startTime' => '<string>',
'endDate' => '<string>',
'endTime' => '<string>',
'languages' => [
'<string>'
],
'region' => '<string>',
'tags' => [
'<string>'
],
'jsonData' => [
[
'loan_id' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'phone_number' => '<string>',
'loan_amount' => 123,
'emi_amount' => 123,
'loan_period' => 123,
'current_emi' => 123,
'emi_due_date' => '<string>',
'payment_status' => '<string>',
'language' => '<string>',
'lead_id' => '<string>',
'lead_date' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.agents.timepay.ai/api/v1/campaigns/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.agents.timepay.ai/api/v1/campaigns/create")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.timepay.ai/api/v1/campaigns/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"campaignType\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"startTime\": \"<string>\",\n \"endDate\": \"<string>\",\n \"endTime\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"region\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"jsonData\": [\n {\n \"loan_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"loan_amount\": 123,\n \"emi_amount\": 123,\n \"loan_period\": 123,\n \"current_emi\": 123,\n \"emi_due_date\": \"<string>\",\n \"payment_status\": \"<string>\",\n \"language\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"lead_date\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"data": {
"id": "camp_abc123",
"name": "Debt Collection Q1"
}
}
{
"success": false,
"error": "ValidationError",
"message": "Missing required field: workflowId"
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}
Headers
string
required
Bearer token for authentication (e.g.,
Bearer <your_token>).Body Parameters
string
required
The name of the campaign.
string
required
A brief description of the campaign’s purpose.
string
required
The type of campaign (e.g.,
emi, edi, lead).Show options
Show options
emiedilead
string
The ID of the workflow to associate with this campaign.
string
required
Start date in
YYYY-MM-DD format.string
required
Start time in
HH:MM format (24-hour).string
required
End date in
YYYY-MM-DD format.string
required
End time in
HH:MM format (24-hour).string[]
required
List of languages supported in this campaign (e.g.,
["english", "hindi"]).Show options
Show options
hindienglishbengalitelugumarathitamilgujaratikannadamalayalampunjabiodiaassamese
string
required
Target region for the campaign (e.g.,
north).Show options
Show options
northsoutheastwestcentral
string[]
Tags for categorization (e.g.,
["priority", "q1"]).array
required
Array of customer objects. The required fields within these objects change based on your campaign focus.
Identifier RequirementDepending on your campaign type, you must provide either a
loan_id (for Debt Collection) or a lead_id (for Lead Generation). Requests missing both will return a 400 Bad Request.- Debt Collection
- Lead Generation
Use this structure if you are managing existing loans.
Show item properties
Show item properties
string
required
Unique identifier for the loan record.
string
required
Customer’s first name as registered in the system.
string
required
Customer’s last name as registered in the system.
string
required
Customer’s primary contact number for payment reminders and notifications.
number
required
Total principal amount of the loan in the account currency.
number
required
Equated Monthly Installment (EMI) amount due for the current billing cycle.
number
required
Total loan tenure expressed as the number of monthly installments.
number
required
The current installment number in the repayment schedule (e.g., 5 of 12).
string
required
Due date for the current EMI payment. Format:
YYYY-MM-DD.string
required
Current status of the customer’s EMI payment.
Show options
Show options
bounced— Payment was attempted but failed (e.g., insufficient funds).pending— Payment is due but not yet initiated.partial— Customer has made a partial payment.paid— Payment has been completed by the customer.received— Payment has been completed by the customer.
string
Preferred language for the AI agent to use during the customer conversation (e.g.,
english, hindi, tamil).Use this structure for new sales or lead acquisition.
Show item properties
Show item properties
string
Unique identifier for the lead record.
string
required
Customer’s first name as registered in the system.
string
required
Customer’s last name as registered in the system.
string
required
Customer’s primary contact number for outreach and follow-ups.
string
required
Date the lead was created or captured. Format:
YYYY-MM-DD.string
Preferred language for the AI agent to use during the customer conversation (e.g.,
english, hindi, tamil).Response
boolean
Indicates if the creation was successful.
string
A confirmation message.
object
string
The error type or code (Error responses only).
{
"success": true,
"message": "Campaign created successfully",
"data": {
"id": "camp_abc123",
"name": "Debt Collection Q1"
}
}
{
"success": false,
"error": "ValidationError",
"message": "Missing required field: workflowId"
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}

