List Customers
List all customers for the authenticated reseller with pagination support.
Query
query ListHandbookCustomers($limit: Int, $offset: Int) {
handbookCustomers(limit: $limit, offset: $offset) {
customers {
userId
email
name
createdAt
customerHandbookLimit
}
total
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | Int | No | Maximum number of customers to return. Defaults to 50. Maximum is 100. |
offset | Int | No | Number of customers to skip for pagination. Defaults to 0. |
Response
{
"data": {
"handbookCustomers": {
"customers": [
{
"userId": "external_user_123",
"email": "[email protected]",
"name": "John Doe",
"createdAt": "2025-01-01T00:00:00Z",
"customerHandbookLimit": 10
},
{
"userId": "external_user_456",
"email": "[email protected]",
"name": "Jane Smith",
"createdAt": "2025-01-02T00:00:00Z",
"customerHandbookLimit": null
}
],
"total": 150
}
}
}
Examples
Get First Page (Default)
query {
handbookCustomers {
customers {
userId
email
name
createdAt
}
total
}
}
Get with Custom Limit
query {
handbookCustomers(limit: 25) {
customers {
userId
email
name
}
total
}
}
Pagination - Second Page
query {
handbookCustomers(limit: 50, offset: 50) {
customers {
userId
email
name
}
total
}
}
Variables
{
"limit": 25,
"offset": 0
}
Response Fields
CustomersList
| Field | Type | Description |
|---|---|---|
customers | [Customer!]! | Array of customer records |
total | Int! | Total number of customers matching the query (before pagination) |
Customer
| Field | Type | Description |
|---|---|---|
userId | String! | External user ID from the reseller system |
email | String! | Email address of the customer |
name | String | Full name of the customer |
createdAt | String! | ISO 8601 timestamp of when the customer was created |
customerHandbookLimit | Int | Per-user handbook generation limit (null means use reseller's global default) |
Pagination Best Practices
- Use consistent page sizes - Stick to a fixed
limitvalue (e.g., 50) - Calculate total pages - Use
total / limitto determine number of pages - Handle edge cases - Check if
totalis 0 or ifcustomersarray is empty - Respect maximum limit - Never exceed 100 items per request
Example Pagination Logic
const limit = 50;
let offset = 0;
let allCustomers = [];
while (true) {
const response = await fetch('https://handbooks.io/api/graphql-reseller', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Token': 'your_api_token',
},
body: JSON.stringify({
query: `
query($limit: Int, $offset: Int) {
handbookCustomers(limit: $limit, offset: $offset) {
customers {
userId
email
name
}
total
}
}
`,
variables: { limit, offset },
}),
});
const { data } = await response.json();
allCustomers.push(...data.handbookCustomers.customers);
if (data.handbookCustomers.customers.length < limit) {
break; // No more customers
}
offset += limit;
}
Notes
- Requires reseller API key authentication
- Maximum
limitis 100. If exceeded, it will be capped at 100 - Results are ordered by creation date (newest first)
- The
totalfield represents the total count before pagination, not the count in the current page - Only returns customers belonging to the authenticated reseller