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

Creates a segment.


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

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?

The newly created segment.

The list of errors that occurred from executing the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation segmentCreate($name: String!, $query: String!) {
  segmentCreate(name: $name, query: $query) {
    segment {
      # Segment fields
    }
    userErrors {
      field
      message
    }
  }
}
Hide code
Input
Copy
{
  "name": "<your-name>",
  "query": "<your-query>"
}