Sales & CRMQu Query

listCustomers

Topics: Commerce

List customers with pagination, filtering, and sorting. Requires customer:list permission.

Returns

CustomerConnection!

Arguments

first

IntOptional

Number of items to return from the start (forward pagination)

last

IntOptional

Number of items to return from the end (backward pagination)

after

StringOptional

Cursor pointing to the item after which to start

before

StringOptional

Cursor pointing to the item before which to start

Filter criteria for customers

Sort order for results

Examples

Browse Customers

query BrowseCustomers($filter: CustomerFilterInput!, $after: String) {
  listCustomers(
    first: 20
    after: $after
    filter: $filter
    sort: [{field: NAME, direction: ASC}]
  ) {
    edges {
      node { id name externalId email isActive }
      cursor
    }
    pageInfo { hasNextPage endCursor }
    totalCount
  }
}

Variables

{
  "filter": {
    "name": {
      "contains": "Northstar"
    },
    "isActive": {
      "eq": true
    }
  },
  "after": null
}
Exact field SDL
"""
List customers with pagination, filtering, and sorting. Requires customer:list permission.
"""
listCustomers(
  """Number of items to return from the start (forward pagination)"""
  first: Int
  """Number of items to return from the end (backward pagination)"""
  last: Int
  """Cursor pointing to the item after which to start"""
  after: String
  """Cursor pointing to the item before which to start"""
  before: String
  """Filter criteria for customers"""
  filter: CustomerFilterInput
  """Sort order for results"""
  sort: [CustomerSortInput!]
): CustomerConnection! @topic(names: ["commerce"]) @topic_example(names: ["crm.browse-customers"])

Declared on Query. Access is checked by the platform for each operation.