Update Customer
curl --request PUT \
--url https://your-site.com/wp-json/latepoint-api/v1/customers/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"is_guest": true,
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": "<string>",
"country": "<string>",
"notes": "<string>",
"avatar_image_id": 123,
"custom_fields": {}
}
'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/customers/{id}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"is_guest": True,
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": "<string>",
"country": "<string>",
"notes": "<string>",
"avatar_image_id": 123,
"custom_fields": {}
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
status: '<string>',
is_guest: true,
address: '<string>',
city: '<string>',
state: '<string>',
zipcode: '<string>',
country: '<string>',
notes: '<string>',
avatar_image_id: 123,
custom_fields: {}
})
};
fetch('https://your-site.com/wp-json/latepoint-api/v1/customers/{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://your-site.com/wp-json/latepoint-api/v1/customers/{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([
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'status' => '<string>',
'is_guest' => true,
'address' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipcode' => '<string>',
'country' => '<string>',
'notes' => '<string>',
'avatar_image_id' => 123,
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$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://your-site.com/wp-json/latepoint-api/v1/customers/{id}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-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.put("https://your-site.com/wp-json/latepoint-api/v1/customers/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/wp-json/latepoint-api/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"updated_at": "<string>"
}
}Customers
Update Customer
Update an existing customer in the system
PUT
/
wp-json
/
latepoint-api
/
v1
/
customers
/
{id}
Update Customer
curl --request PUT \
--url https://your-site.com/wp-json/latepoint-api/v1/customers/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"is_guest": true,
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": "<string>",
"country": "<string>",
"notes": "<string>",
"avatar_image_id": 123,
"custom_fields": {}
}
'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/customers/{id}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"is_guest": True,
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": "<string>",
"country": "<string>",
"notes": "<string>",
"avatar_image_id": 123,
"custom_fields": {}
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
status: '<string>',
is_guest: true,
address: '<string>',
city: '<string>',
state: '<string>',
zipcode: '<string>',
country: '<string>',
notes: '<string>',
avatar_image_id: 123,
custom_fields: {}
})
};
fetch('https://your-site.com/wp-json/latepoint-api/v1/customers/{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://your-site.com/wp-json/latepoint-api/v1/customers/{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([
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'status' => '<string>',
'is_guest' => true,
'address' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipcode' => '<string>',
'country' => '<string>',
'notes' => '<string>',
'avatar_image_id' => 123,
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$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://your-site.com/wp-json/latepoint-api/v1/customers/{id}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-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.put("https://your-site.com/wp-json/latepoint-api/v1/customers/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/wp-json/latepoint-api/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"status\": \"<string>\",\n \"is_guest\": true,\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": \"<string>\",\n \"country\": \"<string>\",\n \"notes\": \"<string>\",\n \"avatar_image_id\": 123,\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"status": "<string>",
"updated_at": "<string>"
}
}Description
This endpoint allows you to update an existing customer’s information in the LatePoint system. You can modify any customer field including personal details, contact information, status, and custom fields.Authentication
Path Parameters
Request Body
Basic Information
Status and Settings
Customer statusPossible values:
active- Active customerinactive- Inactive customerpending_verification- Pending email verificationblocked- Blocked customer
Address Information
Additional Information
Response
Examples
Update Basic Information
curl -X PUT "https://your-site.com/wp-json/latepoint-api/v1/customers/123" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"first_name": "John",
"last_name": "Smith",
"phone": "+1-555-0199"
}'
Update Status and Email
curl -X PUT "https://your-site.com/wp-json/latepoint-api/v1/customers/123" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"email": "john.smith.new@example.com",
"status": "active"
}'
Update Address Information
curl -X PUT "https://your-site.com/wp-json/latepoint-api/v1/customers/123" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"address": "456 Oak Street",
"city": "Los Angeles",
"state": "CA",
"zipcode": "90210",
"country": "US"
}'
Response Examples
Successful Update
{
"success": true,
"message": "Customer updated successfully",
"data": {
"id": 123,
"first_name": "John",
"last_name": "Smith",
"email": "john.smith.new@example.com",
"phone": "+1-555-0199",
"status": "active",
"updated_at": "2024-01-15 14:30:25"
}
}
Validation Error
{
"code": "customer_update_failed",
"message": "Error updating customer: Email already exists",
"data": {
"status": 400
}
}
Customer Not Found
{
"code": "customer_not_found",
"message": "Customer not found",
"data": {
"status": 404
}
}
Error Codes
| Code | Status | Description |
|---|---|---|
customer_not_found | 404 | Customer with specified ID doesn’t exist |
customer_update_failed | 400 | Validation error or update failed |
latepoint_not_available | 503 | LatePoint plugin not loaded |
server_error | 500 | Internal server error |
JavaScript Example
// Update customer information
async function updateCustomer(customerId, updateData) {
try {
const response = await fetch(`https://your-site.com/wp-json/latepoint-api/v1/customers/${customerId}`, {
method: 'PUT',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
const result = await response.json();
if (result.success) {
console.log('Customer updated:', result.data);
return result.data;
} else {
throw new Error(result.message);
}
} catch (error) {
console.error('Error updating customer:', error);
throw error;
}
}
// Usage examples
// Update basic info
const basicUpdate = {
first_name: 'Jane',
last_name: 'Doe',
phone: '+1-555-0123'
};
const updatedCustomer = await updateCustomer(123, basicUpdate);
// Update status
const statusUpdate = {
status: 'active'
};
await updateCustomer(123, statusUpdate);
// Update with custom fields
const customFieldsUpdate = {
notes: 'VIP customer',
custom_fields: {
preferred_time: 'morning',
special_requests: 'Quiet room'
}
};
await updateCustomer(123, customFieldsUpdate);
PHP Example
<?php
// Update customer using WordPress HTTP API
function update_customer($customer_id, $update_data) {
$url = 'https://your-site.com/wp-json/latepoint-api/v1/customers/' . $customer_id;
$response = wp_remote_request($url, array(
'method' => 'PUT',
'headers' => array(
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json'
),
'body' => json_encode($update_data)
));
if (is_wp_error($response)) {
throw new Exception('Request failed: ' . $response->get_error_message());
}
$body = wp_remote_retrieve_body($response);
$data = json_decode($body, true);
if (!$data['success']) {
throw new Exception('Update failed: ' . $data['message']);
}
return $data['data'];
}
// Usage
try {
$updated_customer = update_customer(123, array(
'first_name' => 'Updated Name',
'status' => 'active'
));
echo 'Customer updated: ' . $updated_customer['first_name'];
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
Important Notes
Email Uniqueness: The email address must be unique across all customers. If you try to update a customer with an email that already exists, you will receive a validation error. Partial Updates: You only need to include the fields you want to update. Fields not included in the request will remain unchanged. Status Changes: Changing a customer’s status may affect their ability to book appointments or access the customer portal. Custom Fields: Custom fields are merged with existing ones. To remove a custom field, set its value tonull or an empty string.
WordPress User: If the customer has an associated WordPress user account, some changes (like email) may also update the WordPress user.