/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

TitleTypeDescriptionRequired?
idintID of a single customer to load. Can be used after the slash.
Example:
customers/27
load customer with ID 27
No
pageintNumber of the page to load. Defaults to 1No
sortstringOne 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
sizeintNumber of items per page. Defaults to 20No

Response attributes

Attributes that you will receive in response from the endpoint in JSON format, for example:
{"email": "[email protected]","first_name": "James"}

TitleTypeDescription
idintID of the customer
emailstringEmail of the customer
first_namestringFirst name of the customer
last_namestringLast name of the customer
addressobject containing arraysOne or multiple addresses assigned to the customer
address.ididID of the address
address.shipping.first_namestringFirst name for shipping
address.shipping.last_namestringLast name for shipping
address.shipping.companystringCompany for shipping
address.shipping.streetstringStreet name for shipping
address.shipping.suitestringSuite for shipping
address.shipping.citystringCity for shipping
address.shipping.countrystringCountry for shipping, 2-letter code as per ISO 3166-1
address.shipping.statestringState/province/region for shipping, 2-letter code as per ISO 3166-2
address.shipping.zipstringZip/postal code for shipping
address.billing.first_namestringFirst name for billing
address.billing.last_namestringLast name for billing
address.billing.streetstringStreet name for billing
address.billing.suitestringSuite for billing
address.billing.citystringCity for billing
address.billing.countrystringCountry for billing, 2-letter code as per ISO 3166-1
address.billing.statestringState/province/region for billing, 2-letter code as per ISO 3166-2
address.billing.zipstringZip/postal code for billing
address.phonestringPhone for the address
payment.typestringType of payment method. Can be: Visa, American Express, MasterCard, Discover, JCB, Diners Club, PayPal
payment.last4stringLast 4 digits of the card number, if paid by card
notesstringNotes about the customer, optionally set by the store owner
statistics.last_purchaseintTimestamp of last purchase by the customer
statistics.order_countintNumber of orders the customer has placed
statistics.lifetime_spentintAmount of money spent by customer on this store
ordersarray of intsArray of the customer's order IDs
tagsarray of stringsArray containing the tags of all the products that the customer bought
created_atintTimestamp of the customer creation time
updated_atintTimestamp 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
}