Get All Customers
Retrieves a list of customers with pagination. You can filter the list by name, email, company, status, dates and metafield values.
HTTP Request
- URL:
/customers - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_CUSTOMERorREAD_WRITE_CUSTOMER
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page number to retrieve. Default is 1. |
limit | Integer | Number of customers per page. Default is 10. |
name | String | Filter by first name (partial, case-insensitive match). |
email | String | Filter by exact email address. |
email:in | String | Filter by a comma-separated list of email addresses. |
id | String | Filter by a single customer ID. |
id:in | String | Filter by a comma-separated list of customer IDs. |
company | String | Filter by company ID. |
company:in | String | Filter by a comma-separated list of company IDs. |
isB2B | Boolean | true for business (B2B) customers, false for B2C customers. |
status | String | Filter by status: active, pending, invited or inactive. |
date_created:min | String | Customers created on or after this date (YYYY-MM-DD). |
date_created:max | String | Customers created on or before this date (YYYY-MM-DD). |
date_modified:min | String | Customers updated on or after this date (YYYY-MM-DD). |
date_modified:max | String | Customers updated on or before this date (YYYY-MM-DD). |
metafields:<code> | String | Customers whose metafield <code> equals this value, for example metafields:erp_contact_id=1254. |
metafields-in:<code> | String | Customers whose metafield <code> matches any of these comma-separated values. |
cURL Example
curl --location '<BASE_URL>/customers?page=1&limit=10&status=active&company=665434c100e82884676936b9' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The list of customers was returned successfully.
- 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or a filter value is not valid.
Sample JSON Response
{
"success": true,
"data": [
{
"id": "66a5023524b16685e42a1eda",
"firstName": "Maria",
"lastName": "Lopez",
"email": "maria.lopez@northwindsupply.com",
"phoneNumber": "9735550142",
"notes": "Primary purchasing contact",
"isB2B": true,
"status": "active",
"role": "663a0aff4587085935a4fb94",
"company": "665434c100e82884676936b9",
"verifiedEmail": false,
"newsletter": false,
"productGroups": {
"groups": [],
"restrictStoreProductVisibility": false
},
"address": [
{
"id": "66a5023524b16685e42a1edb",
"firstName": "Maria",
"lastName": "Lopez",
"address1": "1200 Industrial Ave",
"address2": "Suite 4",
"city": "Elizabeth",
"state": { "code": "NJ", "name": "New Jersey" },
"country": { "code": "US", "name": "United States" },
"zipcode": "07202",
"phoneNumber": "9735550142",
"isDefaultAddress": true,
"status": true
}
],
"metaFields": [],
"salesReps": [],
"createdBy": {
"id": "66a0f138a8323b0b86b0f1dc",
"name": "ERP Connector",
"type": "api"
},
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z"
}
],
"pagination": {
"page": 1,
"total": 42,
"count": 10
}
}
Response Details
Customer Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the customer. |
firstName | String | First name of the customer. |
lastName | String | Last name of the customer. |
email | String | Email address of the customer (stored in lowercase). |
phoneNumber | String | Phone number of the customer. |
image | String | URL of the customer's profile image. |
notes | String | Internal notes about the customer. |
isB2B | Boolean | Whether the customer is a business (B2B) customer. |
status | String | Customer status: active, pending, invited or inactive. Default is pending. |
role | String | ID of the customer's role. See Get All Customer Roles. |
company | String | ID of the company the customer belongs to. |
verifiedEmail | Boolean | Whether the customer has verified their email address. |
newsletter | Boolean | Whether the customer is subscribed to the newsletter. |
storeCreditBalance | Number | Store credit balance of the customer, if any. |
paymentAccess | Object | Payment methods the customer can use. See Create Customer. |
productGroups | Object | Product groups the customer can or cannot see. See Create Customer. |
address | Array | Saved addresses of the customer. See Get Customer. |
metaFields | Array | Custom field values. See Metafields. |
salesReps | Array | Sales reps assigned to the customer (id, name, email). |
createdBy | Object | Who created the customer: id, name and type (for example api, admin or store). |
createdAt | String | Date and time the customer was created (ISO 8601). |
updatedAt | String | Date and time the customer was last updated (ISO 8601). |
Pagination Details
| Field | Type | Description |
|---|---|---|
page | Integer | Current page number. |
total | Integer | Total number of customers that match the filters. |
count | Integer | Number of customers returned on this page. |
Notes
- Use
pageandlimitto move through large customer lists. - Dates can be sent as
YYYY-MM-DDor as a full ISO 8601 date and time.