---
title: "customerSegment"
description: "customer Segment"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/queries/customer-segment'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/queries/customer-segment.md'
---
# customerSegment

customer Segment

- **Required Scopes:** `read_store_metrics`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`CustomerSegmentsConnection`

## Required Permissions

* `read_store_metrics`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `after`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements following the specified cursor. The `first` argument must also be specified when using this argument.

* `before`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements preceding the specified cursor. The `last` argument must also be specified when using this argument.

* `first`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the first n elements in the list. 

* `last`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the last n elements in the list. 

* `reverse`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Whether to reverse the order of the list. 
  
  ● true: reverse
  
  ● false: do not reverse
  
  Default value: false

* `shoplineQuery`

  [String!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Query conditions (city != '' and country != '')

## Returns

* `edges`

  [[CustomerSegmentsEdge!]](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/customer-segments-edge.md)

  A List Of Edges

* `pageInfo`

  [PageInfo!](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/page-info.md)

  Infomation to aid in PageInfotion

* `totalCount`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The Total Number
  of Members

## Code Example

```graphql
 {
	customerSegment(after, before, first, last, reverse, shoplineQuery ) 
		 {
			# CustomerSegmentsConnection fields
		}
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

