Update Customer
This PUT endpoint is used to update the details of an existing customer identified by their unique ID. The request allows you to update personal, contact, and address information.
Endpoint
- URL:
/customers/{customer_id} - Method:
PUT
Path Parameters
| Parameter | Type | Description |
|---|---|---|
customer_id | string | The unique identifier of the customer to update. |
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be application/json. |
accessToken | string | Access token for authentication. (required) |
Request Body
The body of the request should be a JSON object containing the updated details of the customer:
| Field | Type | Description |
|---|---|---|
firstName | string | The first name of the customer. (required) |
lastName | string | The last name of the customer. (required) |
email | string | The email of the customer. (required) |
phoneNumber | string | The contact number of the customer. |
status | string | The status of the customer (e.g., "active"). |
address | array | Array of address objects related to the customer. |
company | string | Associated company ID. |
metaFields | array | Array of meta-information fields for the customer. |
notes | string | Optional field for additional notes on the customer. |
Address Object (address[])
| Field | Type | Description |
|---|---|---|
firstName | string | First name of the contact person at the address. |
lastName | string | Last name of the contact person at the address. |
phoneNumber | string | Contact phone number for the address. |
address1 | string | Primary address line. |
address2 | string | Secondary address line. |
city | string | City of the address. |
state | string | State code of the address (e.g., "NJ"). |
country | string | Country code of the address (e.g., "US"). |
zipcode | string | Postal code of the address. |
isDefaultAddress | boolean | Indicates whether this is the default address. |
MetaFields Object (metaFields[])
| Field | Type | Description |
|---|---|---|
code | string | Code for the metafield. |
value | mixed | Value of the metafield. |
Sample Request Body
{
"firstName": "John",
"lastName": "Doe",
"email": "john@aximcommerce.com",
"phoneNumber": "65161861",
"status": "active",
"address": [
{
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "65161861",
"address1": "12/4, test st",
"address2": "",
"city": "Elizabeth",
"state": "NJ",
"country": "US",
"zipcode": "07202",
"isDefaultAddress": false
}
],
"company": "6371cd895b77326cf992d5bb",
"metaFields": [
{
"code": "p21_contact_id",
"value": 12548
}
],
"notes": "NOTE AREA"
}
Response
- Status Code: 200 OK
Success Response Body Structure
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
message | string | Message indicating the update result. |
data | object | Contains details of the updated customer. |
Data Object (data)
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the customer. |
email | string | Email address of the customer. |
firstName | string | First name of the customer. |
lastName | string | Last name of the customer. |
phoneNumber | string | Contact number of the customer. |
role | string | Role ID associated with the customer. |
company | string | Company ID related to the customer. |
status | string | Current status of the customer (e.g., "pending"). |
verifiedEmail | boolean | Indicates if the customer's email is verified. |
newsletter | boolean | Indicates subscription to the newsletter. |
isB2B | boolean | Indicates if the customer is a business customer. |
metaFields | array | Additional metadata related to the customer. |
createdBy | object | Information about who created the customer entry. |
createdAt | string (ISO 8601) | Timestamp of when the customer was created. |
updatedAt | string (ISO 8601) | Timestamp of the last update to the customer data. |
address | object | Address information of the customer. |
Sample Success Response
{
"success": true,
"message": "Customer updated successfully",
"data": {
"id": "638df9e713920facde1a1cfa"
// other updated customer details...
}
}
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | The request body contains invalid data or is missing required fields. |
| 401 Unauthorized | The access token is invalid or missing. |
| 404 Not Found | No customer matches the specified customer_id. |
| 500 Internal Server Error | An error occurred on the server. |
Notes
- Ensure all required fields are included in the request body.
- Confirm your access token is valid and has permissions to update customer data.
- This endpoint updates the specified customer and returns the updated details upon success.