/customers
Loads a list of customers or information on a single customer.
URL parameters
Parameters that you can append to the URL, for example: ?parameter=value
Title | Type | Description | Required? |
---|---|---|---|
id | int | ID of a single customer to load. Can be used after the slash. Example: customers/27 load customer with ID 27 | No |
page | int | Number of the page to load. Defaults to 1 | No |
sort | string | One or more attributes to sort the items by. Defaults to id descending. For descending, add ! before the attribute name. For multiple attributes, separate them by commas. Example: customers?sort=!id,email sort by descending id first, then by ascending email | No |
size | int | Number of items per page. Defaults to 20 | No |
Response attributes
Attributes that you will receive in response from the endpoint in JSON format, for example:
{"email": "[email protected]","first_name": "James"}
Title | Type | Description |
---|---|---|
id | int | ID of the customer |
string | Email of the customer | |
first_name | string | First name of the customer |
last_name | string | Last name of the customer |
address | object containing arrays | One or multiple addresses assigned to the customer |
address.id | id | ID of the address |
address.shipping.first_name | string | First name for shipping |
address.shipping.last_name | string | Last name for shipping |
address.shipping.company | string | Company for shipping |
address.shipping.street | string | Street name for shipping |
address.shipping.suite | string | Suite for shipping |
address.shipping.city | string | City for shipping |
address.shipping.country | string | Country for shipping, 2-letter code as per ISO 3166-1 |
address.shipping.state | string | State/province/region for shipping, 2-letter code as per ISO 3166-2 |
address.shipping.zip | string | Zip/postal code for shipping |
address.billing.first_name | string | First name for billing |
address.billing.last_name | string | Last name for billing |
address.billing.street | string | Street name for billing |
address.billing.suite | string | Suite for billing |
address.billing.city | string | City for billing |
address.billing.country | string | Country for billing, 2-letter code as per ISO 3166-1 |
address.billing.state | string | State/province/region for billing, 2-letter code as per ISO 3166-2 |
address.billing.zip | string | Zip/postal code for billing |
address.phone | string | Phone for the address |
payment.type | string | Type of payment method. Can be: Visa, American Express, MasterCard, Discover, JCB, Diners Club, PayPal |
payment.last4 | string | Last 4 digits of the card number, if paid by card |
notes | string | Notes about the customer, optionally set by the store owner |
statistics.last_purchase | int | Timestamp of last purchase by the customer |
statistics.order_count | int | Number of orders the customer has placed |
statistics.lifetime_spent | int | Amount of money spent by customer on this store |
orders | array of ints | Array of the customer's order IDs |
tags | array of strings | Array containing the tags of all the products that the customer bought |
created_at | int | Timestamp of the customer creation time |
updated_at | int | Timestamp of the customer last update time |
Notes
- Addresses can be managed manually from the customer profile or flow from orders. Changing an address in a customer profile does not affect orders, but changing the address in an order may affect it in the customer profile.
GET https://mystore.commercehq.com/api/v1/customers/30
{
"id": 30,
"email": "[email protected]",
"first_name": "Donald",
"last_name": "Duck",
"address": [
{
"id": 67,
"shipping": {
"first_name": "Donald",
"last_name": "Duck",
"company": null,
"street": "47 Duck Street",
"suite": "1",
"city": "Duckland",
"country": "US",
"state": "CA",
"zip": "12345"
},
"billing": {
"first_name": "Donald",
"last_name": "Duck",
"street": "47 Duck Street",
"suite": "1",
"city": "Duckland",
"country": "US",
"state": "CA",
"zip": "12345"
},
"phone": "123456789"
}
],
"payment": [
{
"type": "Visa",
"last4": "4242"
}
],
"notes": null,
"statistics": {
"last_purchase": 1484313925,
"order_count": 1,
"lifetime_spent": 34
},
"orders": [
91
],
"tags": [],
"created_at": 1484313922,
"updated_at": 1484313922
}