/customers/search

Search for customers by specified parameters.

Request body parameters

Parameters that you can send in the request body in JSON format, for example:
{"email": "[email protected]","first_name": "James"}

TitleTypeDescriptionRequired?
emailstringEmail of the customerNo
first_namestringFirst name of the customerNo
last_namestringLast name of the customerNo
addressobject containing arraysOne or multiple addresses assigned to the customerNo
address.shipping.first_namestringFirst name for shippingNo
address.shipping.last_namestringLast name for shippingNo
address.shipping.companystringCompany for shippingNo
address.shipping.streetstringStreet name for shippingNo
address.shipping.suitestringSuite for shippingNo
address.shipping.citystringCity for shippingNo
address.shipping.countrystringCountry for shipping, 2-letter code as per ISO 3166-1No
address.shipping.statestringState/province/region for shipping, 2-letter code as per ISO 3166-2No
address.shipping.zipstringZip/postal code for shippingNo
address.billing.first_namestringFirst name for billingNo
address.billing.last_namestringLast name for billingNo
address.billing.streetstringStreet name for billingNo
address.billing.suitestringSuite for billingNo
address.billing.citystringCity for billingNo
address.billing.countrystringCountry for billing, 2-letter code as per ISO 3166-1No
address.billing.statestringState/province/region for billing, 2-letter code as per ISO 3166-2No
address.billing.zipstringZip/postal code for billingNo
address.phonestringPhone for the addressNo
notesstringNotes about the customer, optionally set by the store ownerNo

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.
Find the customer with shipping country United States who placed order ID 339 and has 7 orders in total.

POST https://mystore.commercehq.com/api/v1/customers/search
{
    "address": {
        "shipping_country": "US"
    },
    "orders": [339],
    "order_count": 7
}
{
  "items": [
    {
      "id": 6,
      "email": "[email protected]",
      "first_name": "James",
      "last_name": "C Smith",
      "address": [
        {
          "id": 7,
          "shipping": {
            "first_name": "James",
            "last_name": "C Smith",
            "company": null,
            "street": "46 Leatherwood St.",
            "suite": "1432",
            "city": "North Hollywood",
            "country": "US",
            "state": "CA",
            "zip": "91605"
          },
          "billing": {
            "first_name": "James",
            "last_name": "C Smith",
            "street": "46 Leatherwood St.",
            "suite": "1432",
            "city": "North Hollywood",
            "country": "US",
            "state": "CA",
            "zip": "91605"
          },
          "phone": "any string here"
        }
      ],
      "payment": [],
      "notes": "Some Notes about customer",
      "statistics": {
        "last_purchase": null,
        "order_count": 0,
        "lifetime_spent": 0
      },
      "orders": [],
      "tags": [],
      "created_at": 1485004452,
      "updated_at": 0
    },
    {
      "id": 3,
      "email": "[email protected]",
      "first_name": "Ahmet",
      "last_name": "Zahmut",
      "address": [
        {
          "id": 3,
          "shipping": {
            "first_name": "Ahmet",
            "last_name": "Zahmut",
            "company": null,
            "street": "12 Bomber av.",
            "suite": "suite 1322",
            "city": "New York",
            "country": "US",
            "state": "NY",
            "zip": "M4G 2K6"
          },
          "billing": {
            "first_name": "Ahmet",
            "last_name": "Zahmut",
            "street": "12 Bomber av.",
            "suite": "suite 1322",
            "city": "New York",
            "country": "US",
            "state": null,
            "zip": "M4G 2K6"
          },
          "phone": ""
        }
      ],
      "payment": [
        {
          "type": "Visa",
          "last4": "1111"
        }
      ],
      "notes": null,
      "statistics": {
        "last_purchase": 1484826373,
        "order_count": 1,
        "lifetime_spent": 52
      },
      "orders": [
        4
      ],
      "tags": [],
      "created_at": 1484826370,
      "updated_at": 0
    }
  ],
  "_links": {
    "self": {
      "href": "http://dummy-api.com/api/v1/customers/search?page=1"
    }
  },
  "_meta": {
    "totalCount": 2,
    "pageCount": 1,
    "currentPage": 1,
    "perPage": 20
  }
}