Get All Customers
This GET endpoint retrieves a list of customers with pagination support. You can specify the page number and the number of items per page using query parameters.
Endpoint
- URL:
/customers?page={page}&limit={limit} - Method:
GET
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | int | The page number to retrieve. Default is 1. |
limit | int | The number of items per page. Default and max is 10. |
name | string | Filter customers by first name using a case-insensitive regex match. |
email | string | Filter customers by email address using a case-insensitive regex match. |
isB2B | boolean | Filter customers by business type (e.g., true or false). |
status | string | Filter customers by status (e.g., "active", "pending"). |
id | string | Filter customers by a specific ID. |
company | string | Filter customers by company ID. |
id:in | string | Filter customers by a list of IDs (comma-separated). |
email:in | string | Filter customers by a list of email addresses (comma-separated). |
company:in | string | Filter customers by a list of company IDs (comma-separated). |
date_created:min | string | Filter customers created on or after this date (format: YYYY-MM-DD). |
date_created:max | string | Filter customers created on or before this date (format: YYYY-MM-DD). |
date_modified:min | string | Filter customers modified on or after this date (format: YYYY-MM-DD). |
date_modified:max | string | Filter customers modified on or before this date (format: YYYY-MM-DD). |
metafields | object | Filter customers by specific metafield criteria. Example sub-key: metafields:<key> |
metafields-in | object | Filter customers by a list of values for a specific metafield. Example sub-key: metafields-in:<key> |
Note: For metafields and metafields-in, replace <key> with the specific metafield you want to filter by. The queries allow filtering customers based on associated metafield values.
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Request Body
No request body is needed for this GET operation.
Response
- Status Code: 200 OK
Sample Response Body
A successful response will return a list of customers with pagination details:
{
"success": true,
"data": [
{
"email": "Testsample@email.com",
"firstName": "FN",
"lastName": "two",
"phoneNumber": "123456",
"role": "663a0aff4587085935a4fb94",
"company": "665434c100e82884676936b9",
"status": "pending",
"verifiedEmail": false,
"newsletter": false,
"isB2B": true,
"metaFields": [],
"createdBy": {
"id": "66a0f138a8323b0b86b0f1dc",
"name": "Tester Account",
"type": "import"
},
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z",
"id": "66a5023524b16685e42a1eda",
"address": {}
}
],
"pagination": {
"page": 1,
"total": 8,
"count": 8
}
}
Success Response
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
data | array | List of customer objects. |
pagination | object | Pagination details for the response data. |
Customer Object (data[])
| Field | Type | Description |
|---|---|---|
email | string | Email address of the customer. |
firstName | string | First name of the customer. |
lastName | string | Last name of the customer. |
phoneNumber | string | Contact number of the customer. |
role | string | Role ID associated with the customer. |
company | string | Company ID related to the customer. |
status | string | Current status of the customer (e.g., "pending"). |
verifiedEmail | boolean | Indicates if the customer's email is verified. |
newsletter | boolean | Indicates subscription to the newsletter. |
isB2B | boolean | Indicates if the customer is a business customer. |
metaFields | array | Additional metadata related to the customer. |
createdBy | object | Information about who created the customer entry. |
createdAt | string (ISO 8601) | Timestamp of when the customer was created. |
updatedAt | string (ISO 8601) | Timestamp of the last update to the customer data. |
id | string | Unique identifier for the customer. |
address | object | Address information of the customer. |
Pagination Object (pagination)
| Field | Type | Description |
|---|---|---|
page | int | Current page number of the response data. |
total | int | Total number of available pages. |
count | int | Total number of records returned. |
Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | The access token is invalid or missing. |
| 403 Forbidden | You do not have permission to access this resource. |
| 500 Internal Server Error | An error occurred on the server. |
Notes
- Make sure the
accessTokenis valid and that the token has permission to access customer data. - Adjust the
pageandlimitquery parameters to control pagination according to your needs. - Only accessible to authorized users with sufficient access rights.