Skip to main content

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​

ParameterTypeRequiredDescription
limitIntNoMaximum number of customers to return. Defaults to 50. Maximum is 100.
offsetIntNoNumber 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​

FieldTypeDescription
customers[Customer!]!Array of customer records
totalInt!Total number of customers matching the query (before pagination)

Customer​

FieldTypeDescription
userIdString!External user ID from the reseller system
emailString!Email address of the customer
nameStringFull name of the customer
createdAtString!ISO 8601 timestamp of when the customer was created
customerHandbookLimitIntPer-user handbook generation limit (null means use reseller's global default)

Pagination Best Practices​

  1. Use consistent page sizes - Stick to a fixed limit value (e.g., 50)
  2. Calculate total pages - Use total / limit to determine number of pages
  3. Handle edge cases - Check if total is 0 or if customers array is empty
  4. 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 limit is 100. If exceeded, it will be capped at 100
  • Results are ordered by creation date (newest first)
  • The total field represents the total count before pagination, not the count in the current page
  • Only returns customers belonging to the authenticated reseller