curl -X PUT "https://api.example.com/api/leads/123" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 456,
"phone_number": "+1234567890",
"variables": {
"name": "John Doe",
"company": "Acme Corp"
}
}'
const response = await fetch('https://api.example.com/api/leads/123', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
campaign_id: 456,
phone_number: '+1234567890',
variables: {
name: 'John Doe',
company: 'Acme Corp'
}
})
});
const data = await response.json();
$response = Http::withToken('YOUR_API_TOKEN')
->put('https://api.example.com/api/leads/123', [
'campaign_id' => 456,
'phone_number' => '+1234567890',
'variables' => [
'name' => 'John Doe',
'company' => 'Acme Corp'
]
]);
import requests
response = requests.put(
'https://api.example.com/api/leads/123',
headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
json={
'campaign_id': 456,
'phone_number': '+1234567890',
'variables': {
'name': 'John Doe',
'company': 'Acme Corp'
}
}
)
{
"message": "Lead updated successfully"
}
{
"message": "Lead not found"
}
{
"message": "Campaign not found"
}
{
"message": "Invalid phone number"
}
{
"message": "Validation failed",
"errors": {
"campaign_id": ["The selected campaign does not exist"],
"status": ["This status is assigned automatically and cannot be set manually"],
"variables": ["Variables must be an array"]
}
}
{
"message": "Invalid fields: invalid_field, another_invalid_field"
}
Leads
Update Lead
Update an existing lead in your campaigns
PUT
/
api
/
leads
/
{id}
curl -X PUT "https://api.example.com/api/leads/123" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 456,
"phone_number": "+1234567890",
"variables": {
"name": "John Doe",
"company": "Acme Corp"
}
}'
const response = await fetch('https://api.example.com/api/leads/123', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
campaign_id: 456,
phone_number: '+1234567890',
variables: {
name: 'John Doe',
company: 'Acme Corp'
}
})
});
const data = await response.json();
$response = Http::withToken('YOUR_API_TOKEN')
->put('https://api.example.com/api/leads/123', [
'campaign_id' => 456,
'phone_number' => '+1234567890',
'variables' => [
'name' => 'John Doe',
'company' => 'Acme Corp'
]
]);
import requests
response = requests.put(
'https://api.example.com/api/leads/123',
headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
json={
'campaign_id': 456,
'phone_number': '+1234567890',
'variables': {
'name': 'John Doe',
'company': 'Acme Corp'
}
}
)
{
"message": "Lead updated successfully"
}
{
"message": "Lead not found"
}
{
"message": "Campaign not found"
}
{
"message": "Invalid phone number"
}
{
"message": "Validation failed",
"errors": {
"campaign_id": ["The selected campaign does not exist"],
"status": ["This status is assigned automatically and cannot be set manually"],
"variables": ["Variables must be an array"]
}
}
{
"message": "Invalid fields: invalid_field, another_invalid_field"
}
Update a lead by providing the lead ID and the fields you want to modify. Only the fields provided in the request will be updated.
Path Parameters
Body Parameters
Response
curl -X PUT "https://api.example.com/api/leads/123" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 456,
"phone_number": "+1234567890",
"variables": {
"name": "John Doe",
"company": "Acme Corp"
}
}'
const response = await fetch('https://api.example.com/api/leads/123', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
campaign_id: 456,
phone_number: '+1234567890',
variables: {
name: 'John Doe',
company: 'Acme Corp'
}
})
});
const data = await response.json();
$response = Http::withToken('YOUR_API_TOKEN')
->put('https://api.example.com/api/leads/123', [
'campaign_id' => 456,
'phone_number' => '+1234567890',
'variables' => [
'name' => 'John Doe',
'company' => 'Acme Corp'
]
]);
import requests
response = requests.put(
'https://api.example.com/api/leads/123',
headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
json={
'campaign_id': 456,
'phone_number': '+1234567890',
'variables': {
'name': 'John Doe',
'company': 'Acme Corp'
}
}
)
{
"message": "Lead updated successfully"
}
{
"message": "Lead not found"
}
{
"message": "Campaign not found"
}
{
"message": "Invalid phone number"
}
{
"message": "Validation failed",
"errors": {
"campaign_id": ["The selected campaign does not exist"],
"status": ["This status is assigned automatically and cannot be set manually"],
"variables": ["Variables must be an array"]
}
}
{
"message": "Invalid fields: invalid_field, another_invalid_field"
}
Notes
- The lead must belong to the authenticated user
- If updating the campaign, the new campaign must also belong to the authenticated user
- Phone numbers are automatically formatted and validated
- Variables are merged with existing variables (not replaced)
- Only allowed fields can be updated:
campaign_id,phone_number,status,variables - The
statusfield has restricted values for data integrity

