Get a customer
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/customers/1';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://apibase.ecomweb.app/api/v1/stores/example/customers/1 \ --header 'x-api-key: <x-api-key>'Returns one customer with their order figures, sign-in account state, saved addresses and counts, in one response. A deleted customer can still be read; deleted_at is set, and merged_into_id names the customer they were merged into, if any. account.sessions lists the active sessions with their IP address and user agent. It is returned to API keys and to owners and admins, and left out for other staff.
Required scopes: read:customers
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The customer ID.
The store’s ref, as returned by GET /stores.
Responses
Section titled “Responses”object
Account status set by the store.
Ordering activity: active, inactive or never_ordered.
Customer ID.
Full name.
Email address.
Phone number, or null.
Avatar image URL, or null.
Internal notes, or null.
When the customer was created, as an ISO 8601 timestamp.
When the customer was deleted, or null while the customer is live.
For a customer merged into another, the ID of the customer that absorbed them. Null otherwise, including for a customer who was simply deleted.
Order figures.
object
Orders placed.
Cancelled orders.
Refunded orders.
Orders that count towards revenue.
Total spent across revenue orders, in the store currency.
Average value of a revenue order, in the store currency.
Date of the first order, or null.
Date of the latest order, or null.
Days since the latest order, or null.
Guest orders linked to the customer by email.
The sign-in account.
object
Whether the customer has a sign-in account.
Whether the account’s email is verified.
Sign-in methods linked to the account, such as password or google.
When the customer last signed in, or null.
Failed sign-in attempts since the last success.
When the account is locked until, or null when it is not locked.
Number of active sessions.
The active sessions, with IP address and user agent. Returned to API keys and to owners and admins; left out for other staff.
object
Session ID.
When the session started, as an ISO 8601 timestamp.
When the session was last used, or null.
When the session expires, as an ISO 8601 timestamp.
IP address the session was opened from, or null.
Browser or app that opened the session, or null.
Saved addresses.
object
Address ID.
ID of the customer the address belongs to.
A short label such as Home or Office, or null.
Name of the person receiving deliveries.
Contact phone number.
First address line.
Second address line, or null.
Ward code.
Ward name, when it can be resolved from the code.
District, or null.
City, or null.
Province code.
Province name, when it can be resolved from the code.
Postal code, or null.
Country code.
Whether this is the customer’s default address.
When the address was created, as an ISO 8601 timestamp.
When the address was last updated, as an ISO 8601 timestamp.
Totals for the lists above.
object
Orders placed.
Saved addresses.
Example
{ "status": "active", "activity_state": "active"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
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.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}