Update Customer
curl --request PUT \
--url https://api.agents.timepay.ai/api/v1/customers/update \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignId": "<string>",
"loan_id": "<string>",
"lead_id": "<string>",
"data": {
"payment_status": "<string>",
"first_name": "<string>",
"phone_number": "<string>"
}
}
'import requests
url = "https://api.agents.timepay.ai/api/v1/customers/update"
payload = {
"campaignId": "<string>",
"loan_id": "<string>",
"lead_id": "<string>",
"data": {
"payment_status": "<string>",
"first_name": "<string>",
"phone_number": "<string>"
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaignId: '<string>',
loan_id: '<string>',
lead_id: '<string>',
data: {payment_status: '<string>', first_name: '<string>', phone_number: '<string>'}
})
};
fetch('https://api.agents.timepay.ai/api/v1/customers/update', 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/customers/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'campaignId' => '<string>',
'loan_id' => '<string>',
'lead_id' => '<string>',
'data' => [
'payment_status' => '<string>',
'first_name' => '<string>',
'phone_number' => '<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/customers/update"
payload := strings.NewReader("{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.agents.timepay.ai/api/v1/customers/update")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.timepay.ai/api/v1/customers/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Customer data updated successfully",
"data": {
"id": "loan_12345",
"result": "updated"
}
}
{
"success": false,
"message": "Validation failed",
"errors": [
"Either loan_id or lead_id is required"
]
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"message": "Campaign ID invalid or mismatch for your organization."
}
{
"success": false,
"message": "Customer record not found"
}
{
"success": false,
"message": "Version conflict: Record was modified by another process. Please retry."
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}
Customers
Update Customer
Update a single customer record within a campaign.
Update Customer
curl --request PUT \
--url https://api.agents.timepay.ai/api/v1/customers/update \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignId": "<string>",
"loan_id": "<string>",
"lead_id": "<string>",
"data": {
"payment_status": "<string>",
"first_name": "<string>",
"phone_number": "<string>"
}
}
'import requests
url = "https://api.agents.timepay.ai/api/v1/customers/update"
payload = {
"campaignId": "<string>",
"loan_id": "<string>",
"lead_id": "<string>",
"data": {
"payment_status": "<string>",
"first_name": "<string>",
"phone_number": "<string>"
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaignId: '<string>',
loan_id: '<string>',
lead_id: '<string>',
data: {payment_status: '<string>', first_name: '<string>', phone_number: '<string>'}
})
};
fetch('https://api.agents.timepay.ai/api/v1/customers/update', 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/customers/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'campaignId' => '<string>',
'loan_id' => '<string>',
'lead_id' => '<string>',
'data' => [
'payment_status' => '<string>',
'first_name' => '<string>',
'phone_number' => '<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/customers/update"
payload := strings.NewReader("{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.agents.timepay.ai/api/v1/customers/update")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.timepay.ai/api/v1/customers/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaignId\": \"<string>\",\n \"loan_id\": \"<string>\",\n \"lead_id\": \"<string>\",\n \"data\": {\n \"payment_status\": \"<string>\",\n \"first_name\": \"<string>\",\n \"phone_number\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Customer data updated successfully",
"data": {
"id": "loan_12345",
"result": "updated"
}
}
{
"success": false,
"message": "Validation failed",
"errors": [
"Either loan_id or lead_id is required"
]
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"message": "Campaign ID invalid or mismatch for your organization."
}
{
"success": false,
"message": "Customer record not found"
}
{
"success": false,
"message": "Version conflict: Record was modified by another process. Please retry."
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}
Headers
string
required
Bearer token for authentication (e.g.,
Bearer <your_token>).string
Optional. Use this header only when the authenticated user belongs to multiple organizations. It identifies the organization to target for this action.
Body Parameters
string
required
The unique identifier of the campaign (e.g.,
camp_abc123).string
The Loan ID identifying the record. Required if
lead_id is not provided.string
The Lead ID identifying the record. Required if
loan_id is not provided.object
required
Response
boolean
Indicates if the update was successful.
string
A confirmation message.
object
string
The error type or code (Error responses only).
{
"success": true,
"message": "Customer data updated successfully",
"data": {
"id": "loan_12345",
"result": "updated"
}
}
{
"success": false,
"message": "Validation failed",
"errors": [
"Either loan_id or lead_id is required"
]
}
{
"success": false,
"error": "Unauthorized",
"message": "Missing or invalid authorization header"
}
{
"success": false,
"message": "Campaign ID invalid or mismatch for your organization."
}
{
"success": false,
"message": "Customer record not found"
}
{
"success": false,
"message": "Version conflict: Record was modified by another process. Please retry."
}
{
"success": false,
"error": "InternalServerError",
"message": "An unexpected error occurred"
}
Error Codes
| Status | Description |
|---|---|
400 | Validation error - a customer identifier or update data is missing |
401 | Unauthorized - missing or invalid authorization header |
403 | Forbidden - campaign does not belong to the organization |
404 | Customer record not found |
409 | Version conflict while updating the customer record |
500 | Internal server error |

