Customers
A customer is a person who has applied or bought through one of your checkouts. You get contact and address details to match them to your own records.
customersQuery
Your customers with contact and address details. Search by name or email, filter to exact emails or ids, and paginate.
By default, customers are sorted by their most recent order with you, newest first. Ties are ordered by customer ID, newest first. Customers with no order with you come last. Use customerIds for a batch lookup from your own ids, and email for an exact match when you already know the address.
POST/graphql
customers(input: CustomersInput): CustomerConnection!
Arguments
| Name | Type | Description |
|---|---|---|
input.first | Int | Page size, 1–100. Defaults to 25. |
input.after | String | The endCursor from the previous page. Omit it for the first page. |
input.search | String | Matches name or email, case-insensitive. |
input.email | String | An exact email match. |
input.customerIds | [ID!] | Only these customers. |
input.sortBy | CustomerSortField | Sort field. Defaults to LAST_ORDER_DATE. By default, customers are sorted by their most recent order with you, newest first. Ties are ordered by customer ID, newest first. Customers with no order with you come last. |
input.sortDesc | Boolean | Sort descending. Defaults to true (newest first) for LAST_ORDER_DATE and ID, and false (A to Z) for LAST_NAME and EMAIL. Ties are ordered by customer ID, in the same direction. |
Returns
| Field | Type | Description |
|---|---|---|
totalCount | Int! | How many customers match your filter, across every page. |
pageInfo | PageInfo! | hasNextPage tells you whether to keep going; endCursor is what you pass as after. |
edges[].node | Customer | One Customer per edge, with its cursor beside it. The Customer fields follow. |
Each Customer node
| Field | Type | Description |
|---|---|---|
id | ID! | The customer id. Pass it to customer. |
firstName | String! | Given name. |
lastName | String! | Family name. |
email | String! | Email address. |
phoneNumber | String | Phone in E.164 format. Null when missing. |
address | Address | Mailing address. Null when every address field is empty or only the country is set. Fields below. |
Example
query Customers($input: CustomersInput) {
customers(input: $input) {
totalCount
edges { node { id firstName lastName email phoneNumber address { city state zip } } }
}
}{
"input": {
"first": 3,
"search": "example"
}
}{
"data": {
"customers": {
"totalCount": 1,
"edges": [
{
"node": {
"id": "9001",
"firstName": "John",
"lastName": "Example",
"email": "[email protected]",
"phoneNumber": "+15125550142",
"address": {
"city": "Austin",
"state": "TX",
"zip": "78701"
}
}
}
]
}
}
}customerQuery
Fetch one customer by id, with contact and address details. Null when the id isn’t found on your account.
Take the id from customers, an order or a risk row (customerId), or a webhook log.
POST/graphql
customer(id: ID!): Customer
Arguments
| Name | Type | Description |
|---|---|---|
id | ID!required | The customer id. |
Returns
| Field | Type | Description |
|---|---|---|
id | ID! | The customer id. |
firstName | String! | Given name. |
lastName | String! | Family name. |
email | String! | Email address. |
phoneNumber | String | Phone in E.164 format. Null when missing. |
address | Address | Mailing address. Null when every address field is empty or only the country is set. |
Example
query Customer($id: ID!) {
customer(id: $id) {
id firstName lastName email phoneNumber
address { addressLine1 addressLine2 city state zip country }
}
}{
"id": "9001"
}{
"data": {
"customer": {
"id": "9001",
"firstName": "John",
"lastName": "Example",
"email": "[email protected]",
"phoneNumber": "+15125550142",
"address": {
"addressLine1": "100 Congress Ave",
"addressLine2": null,
"city": "Austin",
"state": "TX",
"zip": "78701",
"country": "US"
}
}
}
}