---
title: "Create a Customer Segment"
method: POST
path: "/v2/customer-segments"
tags: ["customer-segments"]
---

# Create a Customer Segment

`POST /v2/customer-segments`

## Request

- Base URL: `https://api.stuut.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.stuut.ai/v2/customer-segments`
- Auth: HTTP bearer

Creates a new customer segment with the specified name, priority, and optional conditions.

## Request body

- CreateCustomerSegmentInput
  - `name` string, required: The name of the segment (case-insensitive unique per org).
  - `description` string, nullable: Optional description of what this segment represents.
  - `priority` integer, required: Lower number = higher priority for conflict resolution when partner matches multiple segments.
  - `conditions` SegmentConditionsInput: Segment filter conditions. Use and_/or_ to combine conditions.
    - `address` AddressConditionInput
      - `country` CountryOperators
        - `in` string[], nullable: Include countries
        - `nin` string[], nullable: Exclude countries
    - `businessUnit` BusinessUnitConditionInput
      - `name` BusinessUnitNameOperators
        - `in` string[], nullable: Include business units
        - `nin` string[], nullable: Exclude business units
    - `customFields` object, nullable
    - `stats` StatsConditionInput: Filter by partner_stats values (forex-converted to org base currency).
      - `total_invoice_balance` StatsNumericOperators: Numeric comparison operators for partner_stats fields (values in org base currency).
        - `eq` integer, nullable
        - `ne` integer, nullable
        - `gt` integer, nullable
        - `gte` integer, nullable
        - `lt` integer, nullable
        - `lte` integer, nullable
      - `overdue_invoice_balance` StatsNumericOperators: Numeric comparison operators for partner_stats fields (values in org base currency).
        - `eq` integer, nullable
        - `ne` integer, nullable
        - `gt` integer, nullable
        - `gte` integer, nullable
        - `lt` integer, nullable
        - `lte` integer, nullable
    - `and` SegmentConditionsInput[], nullable
    - `or` SegmentConditionsInput[], nullable

## Response `200`

Successful Response

- CustomerSegment
  - `created_at` string, date-time, required
  - `modified_at` string, date-time, nullable, required
  - `id` string, required
  - `name` string, required: The name of the segment (case-insensitive unique per org).
  - `description` string, nullable, required: Optional description of what this segment represents.
  - `priority` integer, required: Lower number = higher priority for conflict resolution when partner matches multiple segments.
  - `conditions` object, nullable, required: Rules that determine which partners belong to this segment.
  - `partner_count` integer, nullable, required: Cached number of partners matching this segment.
  - `partner_count_refreshed_at` string, date-time, required
  - `object` string, required: String representing the object's type. Objects of the same type share the same value.

## Other responses

- `409`: Conflict
- `422`: Validation Error

---

[API](https://skmtc.dev/stuut/apis/stuut-api.md) - [All operations](https://skmtc.dev/stuut/apis/stuut-api/llms.txt) - [OpenAPI document](https://skmtc.dev/stuut/apis/stuut-api/revisions/ff0ad16a55ff?raw)
