Update customer
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"profile_image_id": "<string>",
"customer_group_id": "<string>",
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
}
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"profile_image_id": "<string>",
"customer_group_id": "<string>",
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
profile_image_id: '<string>',
customer_group_id: '<string>',
business: {name: '<string>', business_type: '<string>', gstin: '<string>'}
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/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://staging.api.commercengine.io/api/v1/{store_id}/admin/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>',
'profile_image_id' => '<string>',
'customer_group_id' => '<string>',
'business' => [
'name' => '<string>',
'business_type' => '<string>',
'gstin' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"customer": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"full_name": "<string>",
"profile_image_url": "<string>",
"country_code": "<string>",
"phone": "<string>",
"email": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_whatsapp_verified": true,
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"last_seen": "<string>",
"kyc_status": "pending",
"is_verified": true,
"customer_group_id": "<string>",
"tags": [
"<string>"
],
"business": {
"name": "<string>",
"business_type": "<string>",
"pan_number": "<string>",
"gstin": "<string>",
"is_registered_under_gst": true
},
"segments": [
{
"id": "<string>",
"name": "<string>"
}
],
"addresses": [
{
"first_name": "<string>",
"phone": "<string>",
"email": "<string>",
"address_line1": "<string>",
"pincode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "India",
"id": "<string>",
"last_name": "<string>",
"country_code": "<string>",
"address_line2": "<string>",
"landmark": "<string>",
"gstin": "<string>",
"business_name": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_default_shipping": true,
"is_default_billing": true,
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
],
"banking": [
{
"account_type": "inbound",
"account_name": "<string>",
"account_number": "<string>",
"ifsc_code": "<string>",
"bank_name": "<string>",
"id": "<string>",
"is_default": true,
"is_verified": true,
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
],
"loyalty": {
"membership_number": "<string>",
"points_earned": 123,
"points_redeemed": 123,
"points_balance": 123,
"total_spent": 123,
"total_orders": 123,
"lifetime_spent": 123,
"lifetime_orders": 123,
"date_of_join": "2023-11-07T05:31:56Z",
"date_of_assign": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-11-07T05:31:56Z",
"current_tier": {
"id": "<string>",
"name": "<string>"
},
"next_tier": {
"id": "<string>",
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1
},
"name": "<string>",
"renewal_type": "yearly",
"tier_upgrade_criteria": "total-spent"
},
"notification_preferences": {
"transactional": {
"email": true,
"sms": true,
"whatsapp": true
},
"promotional": {
"email": true,
"sms": true,
"whatsapp": true
},
"newsletter": {
"email": true,
"sms": true,
"whatsapp": true
}
}
}
}
}Customers
Update customer
Updates a customer’s profile and returns the updated CustomerDetail object. Change customer_group_id to move the customer to a different Customer Group, which drives group-specific pricing and promotions.
PUT
/
customers
/
{id}
Update customer
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"profile_image_id": "<string>",
"customer_group_id": "<string>",
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
}
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"profile_image_id": "<string>",
"customer_group_id": "<string>",
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
profile_image_id: '<string>',
customer_group_id: '<string>',
business: {name: '<string>', business_type: '<string>', gstin: '<string>'}
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/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://staging.api.commercengine.io/api/v1/{store_id}/admin/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>',
'profile_image_id' => '<string>',
'customer_group_id' => '<string>',
'business' => [
'name' => '<string>',
'business_type' => '<string>',
'gstin' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"customer_group_id\": \"<string>\",\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"customer": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"full_name": "<string>",
"profile_image_url": "<string>",
"country_code": "<string>",
"phone": "<string>",
"email": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_whatsapp_verified": true,
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"last_seen": "<string>",
"kyc_status": "pending",
"is_verified": true,
"customer_group_id": "<string>",
"tags": [
"<string>"
],
"business": {
"name": "<string>",
"business_type": "<string>",
"pan_number": "<string>",
"gstin": "<string>",
"is_registered_under_gst": true
},
"segments": [
{
"id": "<string>",
"name": "<string>"
}
],
"addresses": [
{
"first_name": "<string>",
"phone": "<string>",
"email": "<string>",
"address_line1": "<string>",
"pincode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "India",
"id": "<string>",
"last_name": "<string>",
"country_code": "<string>",
"address_line2": "<string>",
"landmark": "<string>",
"gstin": "<string>",
"business_name": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_default_shipping": true,
"is_default_billing": true,
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
],
"banking": [
{
"account_type": "inbound",
"account_name": "<string>",
"account_number": "<string>",
"ifsc_code": "<string>",
"bank_name": "<string>",
"id": "<string>",
"is_default": true,
"is_verified": true,
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
],
"loyalty": {
"membership_number": "<string>",
"points_earned": 123,
"points_redeemed": 123,
"points_balance": 123,
"total_spent": 123,
"total_orders": 123,
"lifetime_spent": 123,
"lifetime_orders": 123,
"date_of_join": "2023-11-07T05:31:56Z",
"date_of_assign": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-11-07T05:31:56Z",
"current_tier": {
"id": "<string>",
"name": "<string>"
},
"next_tier": {
"id": "<string>",
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1
},
"name": "<string>",
"renewal_type": "yearly",
"tier_upgrade_criteria": "total-spent"
},
"notification_preferences": {
"transactional": {
"email": true,
"sms": true,
"whatsapp": true
},
"promotional": {
"email": true,
"sms": true,
"whatsapp": true
},
"newsletter": {
"email": true,
"sms": true,
"whatsapp": true
}
}
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Customer Id
Body
application/json
10 digit phone number without country code.
file id of media gallery
Moves the customer to a different Customer Group, which drives group-specific pricing and promotions. Send null to fall back to the store's default group.
Show child attributes
Show child attributes
Was this page helpful?
⌘I