Skip to main content
object

Requires read_customers access scope. Also: The user must not have restricted access.

A group of customers that meet specific criteria defined through ShopifyQL query conditions. Common use cases for segments include customer analytics, targeted marketing campaigns, and automated discount eligibility.

The segment's query field contains ShopifyQL conditions that determine membership, such as purchase history, location, or engagement patterns. Tracks when the segment was created with creationDate and when it was last modified with lastEditDate.

DateTime!
non-null

The date and time when the segment was added to the store.

ID!
non-null

A globally-unique ID.

DateTime!
non-null

The date and time when the segment was last updated.

String!
non-null

The name of the segment.

String!
non-null

A precise definition of the segment. The definition is composed of a combination of conditions on facts about customers.


Was this section helpful?

query

Retrieves a customer Segment by ID. Segments are dynamic groups of customers that meet specific criteria defined through ShopifyQL queries.

Use segments for targeted marketing campaigns, analyzing customer behavior, or creating personalized experiences. Each segment includes its name, creation date, and the query that defines which Customer objects belong to it.

Arguments

ID!
required

Find a segment by ID.


query

Returns a paginated list of Segment objects for the shop. Segments are dynamic groups of customers that meet specific criteria defined through ShopifyQL queries. You can filter segments by search query and sort them by creation date or other criteria.

The query supports standard pagination arguments and returns a SegmentConnection containing segment details including names, creation dates, and the query definitions that determine segment membership.

Arguments

Int

The first n elements from the paginated list.

String

The elements that come after the specified cursor.

Int

The last n elements from the paginated list.

String

The elements that come before the specified cursor.

Boolean
Default:false

Reverse the order of the underlying list.

SegmentSortKeys
Default:CREATION_DATE

Sort the underlying list by the given key.

String

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.

Example:

  • query=Bob Norman
  • query=title:green hoodie
id

Filter by id range.

Example:

  • id:1234
  • id:>=1234
  • id:<=1234
string


Was this section helpful?

mutation

Creates a segment.

Arguments

String!
required

The name of the segment to be created. Segment names must be unique.

String!
required

A precise definition of the segment. The definition is composed of a combination of conditions on facts about customers such as email_subscription_status = 'SUBSCRIBED' with this syntax.


mutation

Updates a segment.

Arguments

ID!
required

Specifies the segment to be updated.

String

The new name for the segment.

String

A precise definition of the segment. The definition is composed of a combination of conditions on facts about customers such as email_subscription_status = 'SUBSCRIBED' with this syntax.



Was this section helpful?

interface

Was this section helpful?