Update Contact
curl --request PUT \
--url https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id} \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"customFields": {},
"consentType": "<string>",
"consentSource": "<string>",
"consentTimestamp": "<string>",
"consentIpAddress": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"customFields": {},
"consentType": "<string>",
"consentSource": "<string>",
"consentTimestamp": "<string>",
"consentIpAddress": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
phoneNumber: '<string>',
customFields: {},
consentType: '<string>',
consentSource: '<string>',
consentTimestamp: '<string>',
consentIpAddress: '<string>'
})
};
fetch('https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}', 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.example.com/api/v1/contact-lists/{listId}/contacts/{id}",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'phoneNumber' => '<string>',
'customFields' => [
],
'consentType' => '<string>',
'consentSource' => '<string>',
'consentTimestamp' => '<string>',
'consentIpAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/contact-lists/{listId}/contacts/{id}"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.example.com/api/v1/contact-lists/{listId}/contacts/{id}")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyContacts
Update Contact
Update an existing contact
PUT
/
api
/
v1
/
contact-lists
/
{listId}
/
contacts
/
{id}
Update Contact
curl --request PUT \
--url https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id} \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"customFields": {},
"consentType": "<string>",
"consentSource": "<string>",
"consentTimestamp": "<string>",
"consentIpAddress": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"customFields": {},
"consentType": "<string>",
"consentSource": "<string>",
"consentTimestamp": "<string>",
"consentIpAddress": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
phoneNumber: '<string>',
customFields: {},
consentType: '<string>',
consentSource: '<string>',
consentTimestamp: '<string>',
consentIpAddress: '<string>'
})
};
fetch('https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}', 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.example.com/api/v1/contact-lists/{listId}/contacts/{id}",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'phoneNumber' => '<string>',
'customFields' => [
],
'consentType' => '<string>',
'consentSource' => '<string>',
'consentTimestamp' => '<string>',
'consentIpAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/contact-lists/{listId}/contacts/{id}"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.example.com/api/v1/contact-lists/{listId}/contacts/{id}")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/contact-lists/{listId}/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"customFields\": {},\n \"consentType\": \"<string>\",\n \"consentSource\": \"<string>\",\n \"consentTimestamp\": \"<string>\",\n \"consentIpAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpdate properties of an existing contact. The email address cannot be changed.
Path Parameters
The unique list ID (e.g.,
lst_abc123).The unique contact ID (e.g.,
cnt_abc123).Request Body
Updated first name.
Updated last name.
Updated phone number.
Updated custom field values. Merges with existing fields (use
null to clear a field).Type of consent obtained (NDPR compliance):
explicit, implicit, or legitimate_interest.Where consent was collected (e.g.,
signup_form, import, api).ISO 8601 timestamp when consent was given.
IP address from which consent was given.
Examples
import { MailBreeze } from "mailbreeze";
const mailbreeze = new MailBreeze({ apiKey: "sk_live_xxx" });
const contacts = mailbreeze.contacts("lst_abc123");
// Update basic info
const contact = await contacts.update("cnt_abc123", {
firstName: "Jonathan",
lastName: "Doe-Smith",
});
// Update custom fields
const contact = await contacts.update("cnt_abc123", {
customFields: {
plan: "enterprise",
company: "New Company Inc",
},
});
console.log(contact.updatedAt); // "2024-01-20T14:15:00Z"
from mailbreeze import MailBreeze
client = MailBreeze(api_key="sk_live_xxx")
contacts = client.contacts("lst_abc123")
# Update basic info
contact = await contacts.update("cnt_abc123",
first_name="Jonathan",
last_name="Doe-Smith",
)
# Update custom fields
contact = await contacts.update("cnt_abc123",
custom_fields={
"plan": "enterprise",
"company": "New Company Inc",
},
)
print(contact.updated_at) # "2024-01-20T14:15:00Z"
client := mailbreeze.NewClient("sk_live_xxx")
contacts := client.Contacts("lst_abc123")
// Update basic info
contact, err := contacts.Update(ctx, "cnt_abc123", &mailbreeze.UpdateContactParams{
FirstName: "Jonathan",
LastName: "Doe-Smith",
})
// Update custom fields
contact, err := contacts.Update(ctx, "cnt_abc123", &mailbreeze.UpdateContactParams{
CustomFields: map[string]any{
"plan": "enterprise",
"company": "New Company Inc",
},
})
fmt.Println(contact.UpdatedAt) // "2024-01-20T14:15:00Z"
$mailbreeze = new MailBreeze('sk_live_xxx');
// Update basic info
$response = $mailbreeze->contacts->update('lst_abc123', 'cnt_abc123', [
'firstName' => 'Jonathan',
'lastName' => 'Doe-Smith',
]);
$contact = $response['data'];
// Update custom fields
$response = $mailbreeze->contacts->update('lst_abc123', 'cnt_abc123', [
'customFields' => [
'plan' => 'enterprise',
'company' => 'New Company Inc',
],
]);
$contact = $response['data'];
echo $contact['updatedAt']; // "2024-01-20T14:15:00Z"
let client = Client::new("sk_live_xxx");
let contacts = client.contacts("lst_abc123");
// Update basic info
let contact = contacts.update("cnt_abc123", UpdateContactParams {
first_name: Some("Jonathan".to_string()),
last_name: Some("Doe-Smith".to_string()),
..Default::default()
}).await?;
// Update custom fields
let contact = contacts.update("cnt_abc123", UpdateContactParams {
custom_fields: Some(json!({"plan": "enterprise", "company": "New Company Inc"})),
..Default::default()
}).await?;
println!("{}", contact.updated_at); // "2024-01-20T14:15:00Z"
curl -X PUT "https://api.mailbreeze.com/api/v1/contact-lists/lst_abc123/contacts/cnt_abc123" \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"firstName": "Jonathan",
"customFields": {
"plan": "enterprise"
}
}'
Response
Returns the updated contact object.Example Response
{
"success": true,
"data": {
"id": "cnt_abc123",
"email": "john@example.com",
"firstName": "Jonathan",
"lastName": "Doe-Smith",
"phoneNumber": "+1-555-0123",
"customFields": {
"company": "New Company Inc",
"plan": "enterprise"
},
"status": "active",
"source": "api",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:15:00Z"
},
"meta": {
"timestamp": "2024-01-20T14:15:00.000Z",
"requestId": "req_abc123",
"path": "/api/v1/contact-lists/lst_abc123/contacts/cnt_abc123"
}
}
Errors
| Code | HTTP Status | Description |
|---|---|---|
CONTACT_NOT_FOUND | 404 | Contact with this ID doesn’t exist |
LIST_NOT_FOUND | 404 | List with this ID doesn’t exist |
INVALID_CUSTOM_FIELD | 400 | Custom field key or value is invalid |
VALIDATION_ERROR | 400 | Required custom field missing or invalid |
Email addresses cannot be changed. To update an email, delete the contact and create a new one.
⌘I