Skip to main content

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

ParameterTypeDescription
customer_idstringThe unique identifier of the customer to update.

Authentication

  • Header: accessToken
  • Type: Bearer Token
  • Value: <ACCESS-TOKEN>

Request Headers

HeaderTypeDescription
Content-TypestringMust be application/json.
accessTokenstringAccess token for authentication. (required)

Request Body

The body of the request should be a JSON object containing the updated details of the customer:

FieldTypeDescription
firstNamestringThe first name of the customer. (required)
lastNamestringThe last name of the customer. (required)
emailstringThe email of the customer. (required)
phoneNumberstringThe contact number of the customer.
statusstringThe status of the customer (e.g., "active").
addressarrayArray of address objects related to the customer.
companystringAssociated company ID.
metaFieldsarrayArray of meta-information fields for the customer.
notesstringOptional field for additional notes on the customer.

Address Object (address[])

FieldTypeDescription
firstNamestringFirst name of the contact person at the address.
lastNamestringLast name of the contact person at the address.
phoneNumberstringContact phone number for the address.
address1stringPrimary address line.
address2stringSecondary address line.
citystringCity of the address.
statestringState code of the address (e.g., "NJ").
countrystringCountry code of the address (e.g., "US").
zipcodestringPostal code of the address.
isDefaultAddressbooleanIndicates whether this is the default address.

MetaFields Object (metaFields[])

FieldTypeDescription
codestringCode for the metafield.
valuemixedValue 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

FieldTypeDescription
successbooleanIndicates if the request was successful.
messagestringMessage indicating the update result.
dataobjectContains details of the updated customer.

Data Object (data)

FieldTypeDescription
idstringUnique identifier for the customer.
emailstringEmail address of the customer.
firstNamestringFirst name of the customer.
lastNamestringLast name of the customer.
phoneNumberstringContact number of the customer.
rolestringRole ID associated with the customer.
companystringCompany ID related to the customer.
statusstringCurrent status of the customer (e.g., "pending").
verifiedEmailbooleanIndicates if the customer's email is verified.
newsletterbooleanIndicates subscription to the newsletter.
isB2BbooleanIndicates if the customer is a business customer.
metaFieldsarrayAdditional metadata related to the customer.
createdByobjectInformation about who created the customer entry.
createdAtstring (ISO 8601)Timestamp of when the customer was created.
updatedAtstring (ISO 8601)Timestamp of the last update to the customer data.
addressobjectAddress information of the customer.

Sample Success Response

{
"success": true,
"message": "Customer updated successfully",
"data": {
"id": "638df9e713920facde1a1cfa"
// other updated customer details...
}
}

Error Responses

Status CodeDescription
400 Bad RequestThe request body contains invalid data or is missing required fields.
401 UnauthorizedThe access token is invalid or missing.
404 Not FoundNo customer matches the specified customer_id.
500 Internal Server ErrorAn 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.