Skip to content

Update a customer

PATCH
/stores/{storeRef}/customers/{customerId}
curl --request PATCH \
--url https://apibase.ecomweb.app/api/v1/stores/example/customers/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "name": "example", "phone": "example", "avatar_url": "example", "status": "active", "notes": "example", "reason": "example" }'

Changes the fields you send; fields you leave out stay as they are. Setting status to inactive also blocks the customer’s sign-in. Each changed field is recorded on the customer’s timeline, with the optional reason. The email cannot be changed.

Required scopes: write:customers

customerId
required
integer

The customer ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
name

Full name.

string
phone

Phone number, or null to clear it.

string
nullable
avatar_url

Avatar image URL, or null to clear it.

string
nullable
status

Account status. Setting inactive blocks the customer from signing in.

string
Allowed values: active inactive
notes

Internal notes, or null to clear them.

string
nullable
reason

Why the change was made. Recorded on the customer timeline.

string
<= 500 characters
Media typeapplication/json
object
status
required

Account status set by the store. An inactive customer cannot sign in.

string
Allowed values: active inactive
activity_state

Ordering activity: active for a recent order, inactive for an old one, never_ordered for none. Separate from status.

string
Allowed values: active inactive never_ordered
id
required

Customer ID.

number
email
required

Email address. Empty for a customer created with a phone number only.

string
name
required

Full name.

string
phone

Phone number, or null.

string
nullable
avatar_url

Avatar image URL, or null.

string
nullable
user_id

ID of the sign-in identity linked to the customer, or null for a customer who never signed in.

string
nullable
notes

Internal notes about the customer, or null.

string
nullable
created_at
required

When the customer was created, as an ISO 8601 timestamp.

string
updated_at
required

When the customer was last updated, as an ISO 8601 timestamp.

string
deleted_at

When the customer was deleted, or null while the customer is live.

string
nullable
first_order_date

Date of the first order, as an ISO 8601 timestamp. Absent when the customer has no orders.

string
last_order_date

Date of the latest order, as an ISO 8601 timestamp. Absent when the customer has no orders.

string
days_since_last_order

Days since the latest order. Absent when the customer has no orders.

number
total_orders

Orders placed by the customer.

number
cancelled_orders

Cancelled orders.

number
refunded_orders

Refunded orders.

number
revenue_orders

Orders that count towards revenue: those neither cancelled nor refunded.

number
total_spent

Total spent across revenue orders, in the store currency.

number
avg_order_value

Average value of a revenue order, in the store currency.

number
linked_guest_orders

Orders placed as a guest with the customer’s email and linked to them by it.

number

Example

{
"status": "active",
"activity_state": "active"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}