UpdateCustomer
Type: schema
Description
Names, email, phone, country code, group and tier IDs, status, and tag items, where supported, are trimmed of surrounding whitespace and reject blank or whitespace-only strings. When email, phone or country_code is supplied, the resulting stored contacts must retain at least one email or phone. Contact uniqueness is global across users and stores, including collisions with usernames.
TypeScript Definition
typescript
UpdateCustomer: {{
first_name?: string;
last_name?: string;
/**
* Format: email
* @description Customer email; null clears the email subject to the contact invariant.
*/
email?: string | null;
/** @description 10 ASCII digits without country code; null clears the phone subject to the contact invariant. */
phone?: string | null;
/** @description Country code, e.g. +91. If a nonempty phone changes and country_code is omitted, it is set to +91; otherwise an omitted country code is preserved. */
country_code?: string;
/** @description Moves the customer to a different Customer Group. Null removes the customer from its group (rejected when the store has customer groups enabled). A non-null ID must belong to the store's configured groups. */
customer_group_id?: string | null;
/** @description Null or an empty object leaves business details unchanged. Null name or business_type clears that field; null registered_address leaves addresses unchanged. */
business?: {
name?: string | null;
/** @description Updates only supplied fields on the existing primary address, or creates a primary address when none exists. Always makes it the default billing address; clears primary and billing flags on the user's other addresses, and their shipping flags if this address is default shipping. Omitted or null leaves addresses unchanged. An empty object updates an existing primary's flags; it fails required-field validation when no primary exists. Does not replace or delete addresses or select one by ID. */
registered_address?: components["schemas"]["UpdateCustomerRegisteredAddress"] | null;
business_type?: components["schemas"]["CustomerBusinessType"] | null;
} | null;
tags?: string[];
/** @description Attribute values to set on the customer. Each entry targets an existing store attribute by `key` (its ULID or slug); send `null` as the `value` to clear one. Omit the field to leave attributes unchanged. An empty array leaves existing attributes unchanged. */
attributes?: components["schemas"]["CustomerAttributePayload"][];
/** @description The customer's own data as key-value pairs. Merged into what the customer has: each key sent is set, a key sent as `null` is removed, keys not sent are kept; `null` or `{}` changes nothing. At most 50 keys and 16 KB as JSON. */
metadata?: {
[key: string]: unknown;
} | null;
};
/**
* UpdateCustomerRegisteredAddress
* @description Partial registered address update. Omitted fields retain their values on an existing primary address; serializer defaults do not apply. When no primary exists, first_name, address_line1, pincode, city and state are required. Phone and email must be supplied unless the existing selected account already has them; this validation uses contacts before any changes in the same request. New-address persistence fills omitted phone, email and country_code from the account after its update (country_code falls back to +91), country with India and shipping with false. Strings are trimmed; blank strings are accepted only for last_name, address_line2, landmark, business_name and tax_identification_number.
*/
}Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["UpdateCustomerRegisteredAddress"] | UpdateCustomerRegisteredAddress |
components["schemas"]["CustomerBusinessType"] | CustomerBusinessType |
components["schemas"]["CustomerAttributePayload"] | CustomerAttributePayload |
OpenAPI Schema
json
{
"description": "Names, email, phone, country code, group and tier IDs, status, and tag items, where supported, are trimmed of surrounding whitespace and reject blank or whitespace-only strings. When email, phone or country_code is supplied, the resulting stored contacts must retain at least one email or phone. Contact uniqueness is global across users and stores, including collisions with usernames.",
"type": "object",
"properties": {
"first_name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"last_name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"email": {
"description": "Customer email; null clears the email subject to the contact invariant.",
"type": [
"string",
"null"
],
"format": "email",
"minLength": 1
},
"phone": {
"description": "10 ASCII digits without country code; null clears the phone subject to the contact invariant.",
"anyOf": [
{
"type": "string",
"minLength": 1,
"pattern": "^[0-9]{10}$"
},
{
"type": "null"
}
]
},
"country_code": {
"description": "Country code, e.g. +91. If a nonempty phone changes and country_code is omitted, it is set to +91; otherwise an omitted country code is preserved.",
"type": "string",
"maxLength": 5,
"minLength": 1,
"pattern": "^\\+?\\d{1,4}$"
},
"customer_group_id": {
"description": "Moves the customer to a different Customer Group. Null removes the customer from its group (rejected when the store has customer groups enabled). A non-null ID must belong to the store's configured groups.",
"type": [
"string",
"null"
],
"maxLength": 255,
"minLength": 1
},
"business": {
"description": "Null or an empty object leaves business details unchanged. Null name or business_type clears that field; null registered_address leaves addresses unchanged.",
"type": [
"object",
"null"
],
"properties": {
"name": {
"type": [
"string",
"null"
],
"maxLength": 255,
"minLength": 1
},
"registered_address": {
"description": "Updates only supplied fields on the existing primary address, or creates a primary address when none exists. Always makes it the default billing address; clears primary and billing flags on the user's other addresses, and their shipping flags if this address is default shipping. Omitted or null leaves addresses unchanged. An empty object updates an existing primary's flags; it fails required-field validation when no primary exists. Does not replace or delete addresses or select one by ID.",
"anyOf": [
{
"$ref": "#/components/schemas/UpdateCustomerRegisteredAddress"
},
{
"type": "null"
}
]
},
"business_type": {
"anyOf": [
{
"$ref": "#/components/schemas/CustomerBusinessType"
},
{
"type": "null"
}
]
}
}
},
"tags": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"attributes": {
"description": "Attribute values to set on the customer. Each entry targets an existing store attribute by `key` (its ULID or slug); send `null` as the `value` to clear one. Omit the field to leave attributes unchanged. An empty array leaves existing attributes unchanged.",
"type": "array",
"items": {
"$ref": "#/components/schemas/CustomerAttributePayload"
}
},
"metadata": {
"description": "The customer's own data as key-value pairs. Merged into what the customer has: each key sent is set, a key sent as `null` is removed, keys not sent are kept; `null` or `{}` changes nothing. At most 50 keys and 16 KB as JSON.",
"type": [
"object",
"null"
],
"additionalProperties": true
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/admin-pos/schemas/UpdateCustomer"
},
"title": "UpdateCustomer",
"x-tags": [
"Customers"
]
}Auto-generated from OpenAPI spec and TypeScript definitions