customers
Returns a list of customers.
CustomerConnection arguments
- Anchor to afterafter•
The elements that come after the specified cursor.
- Anchor to beforebefore•
The elements that come before the specified cursor.
- Anchor to firstfirst•
The first
n
elements from the paginated list.- Anchor to lastlast•
The last
n
elements from the paginated list.- Anchor to queryquery•
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to default•string
Filter by a case-insensitive search of multiple fields in a document.
query=Bob Norman
query=title:green hoodie
- Anchor to email•string
The customer's email address, used to communicate information about orders and for the purposes of email marketing campaigns. You can use a wildcard value to filter the query by customers who have an email address specified.
email:bo.wang@example.com
email:*
- Anchor to phone•string
The phone number of the customer, used to communicate information about orders and for the purposes of SMS marketing campaigns. You can use a wildcard value to filter the query by customers who have a phone number specified.
phone:+18005550100
phone:*
- Anchor to updated_at•time
The date and time, matching a whole day, when the customer's information was last updated.
Example:
Example:
Example:
Example:
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•
Key CustomerSort Default:IDKeys Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
Anchor to Possible returnsPossible returns
- Anchor to edgesedges•[Customer
Edge!]! non-null The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
- Anchor to nodesnodes•[Customer!]!non-null
A list of nodes that are contained in CustomerEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
- Anchor to pageInfopage•
Info PageInfo! non-null An object that’s used to retrieve cursor information about the current page.
Examples
query {
customers(first: 5, query: "country:canada") {
edges {
node {
id
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { customers(first: 5, query: \"country:canada\") { edges { node { id } } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
customers(first: 5, query: "country:canada") {
edges {
node {
id
}
}
}
}`,
);
const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
customers(first: 5, query: "country:canada") {
edges {
node {
id
}
}
}
}
QUERY
response = client.query(query: query)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
customers(first: 5, query: "country:canada") {
edges {
node {
id
}
}
}
}`,
});