> ## Documentation Index
> Fetch the complete documentation index at: https://developer.instantly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a segment

> Changes the name, description or definition of a segment. Send the `revision` you last read as `expected_revision`: if the segment changed since, the update gives 409 and you should read it again.


Requires one of the following scopes: `email_marketing_subscribers:update`, `email_marketing_subscribers:all`, `all:update`, `all:all`



## OpenAPI

````yaml https://api.instantly.ai/openapi/api_v2.json patch /api/v2/email-marketing/segments/{id}
openapi: 3.1.0
info:
  title: API Explorer
  description: >-
    The entire API V2 documentation is interactive and can be tested here. To
    the right side of every endpoint you will see a box with an example request.
    You can click on the "Try it" button to send a request to the server right
    from the docs. You will need to provide an API key by clicking the
    `ApiKeyAuth_token` blue text.
  version: 2.0.0
servers:
  - url: https://api.instantly.ai
    description: Instantly API Server
security:
  - ApiKeyAuth: []
tags:
  - name: Analytics
    description: Endpoints related to analytics
    x-group: Analytics
  - name: OAuth
    description: >-
      OAuth authentication endpoints for connecting Google and Microsoft email
      accounts
    x-group: OAuth
  - name: Account
    description: An email account that can be used to send campaigns
    x-group: Account
  - name: Campaign
    description: A campaign that can be sent to a list of recipients
    x-group: Campaign
  - name: Email
    description: >-
      A campaign email, a reply, a manually sent email, or any other email
      that's visible in the Unibox
    x-group: Email
  - name: EmailVerification
    description: A single email verification
    x-group: Email Verification
  - name: LeadList
    description: A list used to store leads
    x-group: Lead List
  - name: InboxPlacementTest
    description: An inbox placement test
    x-group: Inbox Placement Test
  - name: InboxPlacementAnalytics
    description: Analytics data for individual emails in inbox placement tests
    x-group: Inbox Placement Analytics
  - name: InboxPlacementBlacklistAndSpamAssassinReport
    description: Report data for an inbox placement test
    x-group: Inbox Placement Blacklist And SpamAssassin Report
  - name: AIInboxManager
    description: An AI Inbox Manager agent
    x-group: AI Inbox Manager
  - name: AIDeliverabilityAgent
    description: An AI Deliverability Agent
    x-group: AI Deliverability Agent
  - name: AILeadFinderAgent
    description: An AI Lead Finder Agent
    x-group: AI Lead Finder Agent
  - name: LocalBusiness
    description: >-
      A local business found by the Local businesses search. Search businesses
      by category and location, then convert them into leads with a verified
      email in a lead list or a campaign.
    x-group: Local Business
  - name: Creator
    description: >-
      A social media creator found by the Creators search. Search creators by
      platform, niche, audience and location, then convert them into leads with
      their email.
    x-group: Creator
  - name: APIKey
    description: API Key
    x-group: API Key
  - name: AccountCampaignMapping
    description: Account Campaign Mapping
    x-group: Account Campaign Mapping
  - name: Lead
    description: A lead entity representing an individual lead
    x-group: Lead
  - name: BackgroundJob
    description: A background job that can be used to perform long-running tasks
    x-group: Background Job
  - name: CustomTag
    description: >-
      A custom tag for organizing and categorizing accounts and campaigns. You
      can use them as filters in apis that list accounts and campaigns.
    x-group: Custom Tag
  - name: CustomTagMapping
    description: >-
      This entity represents a tag being assigned to a specific campaign or
      email account. When an email account is assigned a tag, a new custom tag
      mapping entry is created, which connects the tag (`tag_id` field) with the
      email account (`resource_id` field). You can use it to see which tag si
      connected to which resource.
    x-group: Custom Tag Mapping
  - name: BlockListEntry
    description: A blocked email or domain
    x-group: Block List Entry
  - name: LeadLabel
    description: A custom label for categorizing and managing leads
    x-group: Lead Label
  - name: Workspace
    description: A workspace entity representing a workspace
    x-group: Workspace
  - name: Workflow
    description: >-
      Defines an automation workflow with its configuration, status, and
      associated meta data.
    x-group: Workflow
  - name: SuperSearchEnrichment
    description: >-
      An enrichment can take different forms, such as email enrichment or
      LinkedIn enrichment. Leads may be imported from SuperSearch using the
      dedicated endpoint, or enriched directly within a list or campaign by
      attaching an enrichment to it.
    x-group: SuperSearch Enrichment
  - name: WorkspaceGroupMember
    description: >-
      A member of a workspace group. You can use the endpoints within this
      entity to manage the members of a workspace group.
    x-group: Workspace Group Member
  - name: WorkspaceMember
    description: A member of a workspace with associated user details
    x-group: Workspace Member
  - name: CampaignSubsequence
    description: A subsequence entity representing a follow-up sequence
    x-group: Campaign Subsequence
  - name: AuditLog
    description: Audit log records for tracking system activities
    x-group: Audit Log
  - name: AISalesAgent
    description: >-
      An AI Sales Development Representative that autonomously manages outreach
      campaigns
    x-group: AI Sales Agent
  - name: Webhook
    description: A webhook subscription for receiving event notifications
    x-group: Webhook
  - name: WebhookEvent
    description: A webhook event that was sent or attempted to be sent
    x-group: Webhook Event
  - name: DFYEmailAccountOrder
    description: A Done-For-You email account order
    x-group: DFY Email Account Order
  - name: DomainForwarding
    description: Web forwarding configuration for a domain ordered through Instantly
    x-group: Domain Forwarding
  - name: CustomPromptTemplate
    description: Custom prompt templates for creating custom prompts
    x-group: Custom Prompt Template
  - name: SalesFlow
    description: >-
      Manages how sales users view and interact with campaign and lead lists
      within the sales flow.
    x-group: Sales Flow
  - name: EmailTemplate
    description: A campaign email template
    x-group: Email Template
  - name: WorkspaceBilling
    description: Workspace Billing
    x-group: Workspace Billing
  - name: CRMActions
    description: CRM related actions
    x-group: CRM Actions
  - name: SubscriberGroup
    description: >-
      A group of email marketing subscribers. Optional fields with no value are
      left out of responses. Lists page with `starting_after`: pass the previous
      page's `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Subscriber Group'
  - name: SubscriberGroupImport
    description: >-
      A CSV import into a subscriber group. Emails already in the group are
      skipped, not updated. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Subscriber Group Import'
  - name: Subscriber
    description: >-
      An individual contact within a subscriber group. Optional fields with no
      value are left out of responses. Lists page with `starting_after`: pass
      the previous page's `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Subscriber'
  - name: Segment
    description: >-
      A saved set of rules that selects contacts. Membership is worked out each
      time the segment is used. Optional fields with no value are left out of
      responses. Lists page with `cursor`: pass the previous page's
      `next_cursor` until there is none.
    x-group: 'Inbound & Lifecycle: Segment'
  - name: Broadcast
    description: >-
      An email marketing broadcast campaign. Optional fields with no value are
      left out of responses. Lists page with `starting_after`: pass the previous
      page's `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Broadcast'
  - name: Domain
    description: >-
      An email sending domain. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Domain'
  - name: Journey
    description: >-
      A customer journey, triggered by an event or by membership of a segment.
      Optional fields with no value are left out of responses. Lists page with
      `starting_after`: pass the previous page's `next_starting_after` until
      there is none. Step contacts page with `cursor` and `next_cursor` instead.
    x-group: 'Inbound & Lifecycle: Journey'
  - name: EventCatalogEntry
    description: >-
      An event type seen in this workspace, which journey triggers and
      conversions can use. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Event Catalog Entry'
  - name: Template
    description: >-
      An email marketing template. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Template'
  - name: TemplateAsset
    description: >-
      An image or file uploaded for use in email templates. Optional fields with
      no value are left out of responses. Lists page with `starting_after`: pass
      the previous page's `next_starting_after` until there is none.
    x-group: 'Inbound & Lifecycle: Template Asset'
  - name: EmailMetrics
    description: >-
      Aggregated email marketing metrics including totals, time-series data, and
      metadata.
    x-group: 'Inbound & Lifecycle: Email Metrics'
  - name: Conversion
    description: >-
      A conversion event received for a person, credited to the emails they got
      before it.
    x-group: 'Inbound & Lifecycle: Conversion'
  - name: EngageItem
    description: >-
      A unified Engage item representing a campaign, AI agent, automation
      workflow, broadcast, or journey.
    x-group: Engage Item
paths:
  /api/v2/email-marketing/segments/{id}:
    patch:
      tags:
        - Segment
      summary: Update a segment
      description: >-
        Changes the name, description or definition of a segment. Send the
        `revision` you last read as `expected_revision`: if the segment changed
        since, the update gives 409 and you should read it again.



        Requires one of the following scopes:
        `email_marketing_subscribers:update`, `email_marketing_subscribers:all`,
        `all:update`, `all:all`
      operationId: updateSegment
      parameters:
        - schema:
            type: string
            format: uuid
            example: 0198a123-4567-7890-abcd-ef0123456789
          example: 0198a123-4567-7890-abcd-ef0123456789
          in: path
          name: id
          required: true
          description: The ID of the saved segment
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                expected_revision:
                  type: integer
                  minimum: 1
                  description: >-
                    The `revision` you last read. If the segment changed since,
                    the update gives 409.
                  example: 1
                name:
                  type: string
                  minLength: 1
                  maxLength: 150
                  pattern: .*\S.*
                  description: New name, up to 150 characters
                  example: Active trial users
                description:
                  type:
                    - string
                    - 'null'
                  minLength: 1
                  maxLength: 500
                  pattern: .*\S.*
                  description: New description, up to 500 characters. Null clears it.
                  example: Signed up recently
                definition:
                  type: object
                  description: >-
                    Rules that select contacts. A contact matches when it
                    matches every clause of at least one group. A definition
                    that compiles to more than 4 KB gives 400; keep long value
                    lists short.
                  properties:
                    groups:
                      type: array
                      minItems: 1
                      maxItems: 5
                      description: >-
                        1 to 5 groups. A contact matches when it matches any
                        group.
                      items:
                        type: object
                        properties:
                          clauses:
                            type: array
                            minItems: 1
                            maxItems: 5
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - email
                                            - first_name
                                            - last_name
                                          examples:
                                            - email
                                          description: Contact field the clause tests
                                          example: email
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      maxLength: 256
                                      examples:
                                        - growth
                                      example: growth
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - email
                                            - first_name
                                            - last_name
                                          examples:
                                            - email
                                          description: Contact field the clause tests
                                          example: email
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - contains
                                        - not_contains
                                        - starts_with
                                      examples:
                                        - contains
                                      description: How the operand is compared
                                      example: contains
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      maxLength: 256
                                      examples:
                                        - growth
                                      minLength: 1
                                      example: growth
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - email
                                            - first_name
                                            - last_name
                                          examples:
                                            - email
                                          description: Contact field the clause tests
                                          example: email
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - exists
                                        - not_exists
                                      examples:
                                        - exists
                                      description: How the operand is compared
                                      example: exists
                                  required:
                                    - operand
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - consent_status
                                          examples:
                                            - consent_status
                                          description: Contact field the clause tests
                                          example: consent_status
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      enum:
                                        - never_consented
                                        - subscribed
                                        - unsubscribed
                                      examples:
                                        - never_consented
                                      example: never_consented
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - delivery_status
                                          examples:
                                            - delivery_status
                                          description: Contact field the clause tests
                                          example: delivery_status
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      enum:
                                        - deliverable
                                        - hard_bounced
                                        - complained
                                        - suppressed
                                      examples:
                                        - deliverable
                                      example: deliverable
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - origin
                                          examples:
                                            - origin
                                          description: Contact field the clause tests
                                          example: origin
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      enum:
                                        - event
                                        - import
                                        - api
                                        - sync
                                      examples:
                                        - event
                                      example: event
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - created_at
                                            - updated_at
                                            - last_delivered_at
                                            - last_opened_at
                                            - last_clicked_at
                                          examples:
                                            - created_at
                                          description: Contact field the clause tests
                                          example: created_at
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - before
                                        - after
                                        - 'on'
                                      examples:
                                        - before
                                      description: How the operand is compared
                                      example: before
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      format: date-time
                                      examples:
                                        - '2026-11-24T11:57:07.732Z'
                                      example: '2026-11-24T11:57:07.732Z'
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - created_at
                                            - updated_at
                                            - last_delivered_at
                                            - last_opened_at
                                            - last_clicked_at
                                          examples:
                                            - created_at
                                          description: Contact field the clause tests
                                          example: created_at
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - within_last_days
                                      examples:
                                        - within_last_days
                                      description: How the operand is compared
                                      example: within_last_days
                                    value:
                                      description: Value the operand is compared with
                                      type: integer
                                      minimum: 1
                                      maximum: 365
                                      examples:
                                        - 30
                                      example: 30
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - created_at
                                            - updated_at
                                            - last_delivered_at
                                            - last_opened_at
                                            - last_clicked_at
                                          examples:
                                            - created_at
                                          description: Contact field the clause tests
                                          example: created_at
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - more_than_days_ago
                                        - exactly_days_ago
                                      examples:
                                        - more_than_days_ago
                                      description: How the operand is compared
                                      example: more_than_days_ago
                                    value:
                                      description: Value the operand is compared with
                                      type: integer
                                      minimum: 0
                                      maximum: 365
                                      examples:
                                        - 30
                                      example: 30
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - created_at
                                            - updated_at
                                            - last_delivered_at
                                            - last_opened_at
                                            - last_clicked_at
                                          examples:
                                            - created_at
                                          description: Contact field the clause tests
                                          example: created_at
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - less_than_days_ago
                                      examples:
                                        - less_than_days_ago
                                      description: How the operand is compared
                                      example: less_than_days_ago
                                    value:
                                      description: Value the operand is compared with
                                      type: integer
                                      minimum: 1
                                      maximum: 365
                                      examples:
                                        - 30
                                      example: 30
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - created_at
                                            - updated_at
                                            - last_delivered_at
                                            - last_opened_at
                                            - last_clicked_at
                                          examples:
                                            - created_at
                                          description: Contact field the clause tests
                                          example: created_at
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - exists
                                        - not_exists
                                      examples:
                                        - exists
                                      description: How the operand is compared
                                      example: exists
                                  required:
                                    - operand
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - custom_attribute
                                          examples:
                                            - custom_attribute
                                          description: Contact field the clause tests
                                          example: custom_attribute
                                        key:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          examples:
                                            - plan
                                          description: Name of the custom attribute
                                          example: plan
                                      required:
                                        - field
                                        - key
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      maxLength: 256
                                      examples:
                                        - growth
                                      example: growth
                                    value_type:
                                      type: string
                                      enum:
                                        - string
                                      examples:
                                        - string
                                      description: >-
                                        Type of `value`, matching the type
                                        stored in the custom attribute
                                      example: string
                                  required:
                                    - operand
                                    - operator
                                    - value
                                    - value_type
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - custom_attribute
                                          examples:
                                            - custom_attribute
                                          description: Contact field the clause tests
                                          example: custom_attribute
                                        key:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          examples:
                                            - plan
                                          description: Name of the custom attribute
                                          example: plan
                                      required:
                                        - field
                                        - key
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                        - greater_than
                                        - less_than
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: number
                                      examples:
                                        - 10
                                      example: 10
                                    value_type:
                                      type: string
                                      enum:
                                        - number
                                      examples:
                                        - number
                                      description: >-
                                        Type of `value`, matching the type
                                        stored in the custom attribute
                                      example: number
                                  required:
                                    - operand
                                    - operator
                                    - value
                                    - value_type
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - custom_attribute
                                          examples:
                                            - custom_attribute
                                          description: Contact field the clause tests
                                          example: custom_attribute
                                        key:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          examples:
                                            - plan
                                          description: Name of the custom attribute
                                          example: plan
                                      required:
                                        - field
                                        - key
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                      examples:
                                        - equals
                                      description: How the operand is compared
                                      example: equals
                                    value:
                                      description: Value the operand is compared with
                                      type: boolean
                                      examples:
                                        - true
                                      example: true
                                    value_type:
                                      type: string
                                      enum:
                                        - boolean
                                      examples:
                                        - boolean
                                      description: >-
                                        Type of `value`, matching the type
                                        stored in the custom attribute
                                      example: boolean
                                  required:
                                    - operand
                                    - operator
                                    - value
                                    - value_type
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - custom_attribute
                                          examples:
                                            - custom_attribute
                                          description: Contact field the clause tests
                                          example: custom_attribute
                                        key:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          examples:
                                            - plan
                                          description: Name of the custom attribute
                                          example: plan
                                      required:
                                        - field
                                        - key
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - contains
                                        - not_contains
                                        - starts_with
                                      examples:
                                        - contains
                                      description: How the operand is compared
                                      example: contains
                                    value:
                                      description: Value the operand is compared with
                                      type: string
                                      maxLength: 256
                                      examples:
                                        - growth
                                      minLength: 1
                                      example: growth
                                    value_type:
                                      type: string
                                      enum:
                                        - string
                                      examples:
                                        - string
                                      description: >-
                                        Type of `value`, matching the type
                                        stored in the custom attribute
                                      example: string
                                  required:
                                    - operand
                                    - operator
                                    - value
                                    - value_type
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - custom_attribute
                                          examples:
                                            - custom_attribute
                                          description: Contact field the clause tests
                                          example: custom_attribute
                                        key:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          examples:
                                            - plan
                                          description: Name of the custom attribute
                                          example: plan
                                      required:
                                        - field
                                        - key
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - exists
                                        - not_exists
                                      examples:
                                        - exists
                                      description: How the operand is compared
                                      example: exists
                                  required:
                                    - operand
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - email_activity
                                          examples:
                                            - email_activity
                                          description: Contact field the clause tests
                                          example: email_activity
                                        kind:
                                          type: string
                                          enum:
                                            - broadcast
                                          examples:
                                            - broadcast
                                          description: Kind of email the activity is on
                                          example: broadcast
                                        broadcast_id:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                          pattern: ^[^:\s]+$
                                          examples:
                                            - 0198a123-4567-7890-abcd-ef0123456789
                                          description: >-
                                            Broadcast whose email the contact
                                            delivered, opened or clicked
                                          example: 0198a123-4567-7890-abcd-ef0123456789
                                        activity:
                                          type: string
                                          enum:
                                            - delivered
                                            - opened
                                            - clicked
                                          examples:
                                            - opened
                                          description: What the contact did with that email
                                          example: opened
                                      required:
                                        - field
                                        - kind
                                        - broadcast_id
                                        - activity
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - exists
                                        - not_exists
                                      examples:
                                        - exists
                                      description: How the operand is compared
                                      example: exists
                                  required:
                                    - operand
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    operand:
                                      type: object
                                      description: What the clause tests
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - tag_ids
                                            - group_ids
                                          examples:
                                            - tag_ids
                                          description: Contact field the clause tests
                                          example: tag_ids
                                      required:
                                        - field
                                      additionalProperties: false
                                    operator:
                                      type: string
                                      enum:
                                        - includes_any
                                        - includes_all
                                        - not_includes
                                      examples:
                                        - includes_any
                                      description: How the operand is compared
                                      example: includes_any
                                    value:
                                      description: Value the operand is compared with
                                      type: array
                                      minItems: 1
                                      maxItems: 20
                                      uniqueItems: true
                                      items:
                                        type: string
                                        maxLength: 256
                                        examples:
                                          - growth
                                        minLength: 1
                                        example: growth
                                      examples:
                                        - - tag-id
                                      example:
                                        - tag-id
                                  required:
                                    - operand
                                    - operator
                                    - value
                                  additionalProperties: false
                            description: >-
                              1 to 5 clauses. A contact matches the group when
                              it matches every clause.
                        required:
                          - clauses
                        additionalProperties: false
                    timezone:
                      type: string
                      minLength: 1
                      maxLength: 100
                      description: >-
                        IANA time zone name used for day-based date clauses such
                        as `on` and `within_last_days`. Defaults to UTC. An
                        unknown zone gives 400.
                      example: Europe/Bucharest
                  required:
                    - groups
                  additionalProperties: false
              required:
                - expected_revision
              anyOf:
                - type: object
                  required:
                    - name
                - type: object
                  required:
                    - description
                - type: object
                  required:
                    - definition
              additionalProperties: false
        required: true
      responses:
        '200':
          description: The updated segment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          description: >-
            The request is invalid. `message` names the field and the problem.
            `code` is `FST_ERR_VALIDATION` when the request does not match this
            schema and `VALIDATION_ERROR` when a value is refused after that. A
            request the resource's current state does not allow, such as pausing
            a broadcast that is not sending, has its own `code` named on that
            operation. `code` is absent on a few request-level checks.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The request is invalid. `message` names the field and the
                  problem. `code` is `FST_ERR_VALIDATION` when the request does
                  not match this schema and `VALIDATION_ERROR` when a value is
                  refused after that. A request the resource's current state
                  does not allow, such as pausing a broadcast that is not
                  sending, has its own `code` named on that operation. `code` is
                  absent on a few request-level checks.
                properties:
                  statusCode:
                    type: number
                    example: 400
                  error:
                    type: string
                    example: Bad Request
                  message:
                    type: string
                    example: 'limit: must be at most 50'
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: VALIDATION_ERROR
        '401':
          description: >-
            This request is unauthorized (either the Authorization header is
            missing or invalid, or the API key has been revoked)
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 401
                    examples:
                      - 401
                    example: 401
                  error:
                    type: string
                    enum:
                      - Unauthorized
                    examples:
                      - Unauthorized
                    example: Unauthorized
                  message:
                    type: string
                    examples:
                      - Missing Authorization header
                    example: Missing Authorization header
                required:
                  - statusCode
                  - error
                  - message
        '402':
          description: >-
            This request cannot be fulfilled because the workspace does not have
            an active paid plan
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 402
                    examples:
                      - 402
                    example: 402
                  error:
                    type: string
                    enum:
                      - Payment Required
                    examples:
                      - Payment Required
                    example: Payment Required
                  message:
                    type: string
                    examples:
                      - Workspace does not have an active paid plan
                    example: Workspace does not have an active paid plan
                required:
                  - statusCode
                  - error
                  - message
        '403':
          description: >-
            The workspace may not perform this action, for example while it is
            suspended. A key without the required scope gets a 401.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The workspace may not perform this action, for example while
                  it is suspended. A key without the required scope gets a 401.
                properties:
                  statusCode:
                    type: number
                    example: 403
                  error:
                    type: string
                    example: Forbidden
                  message:
                    type: string
                    example: >-
                      Workspace suspended due to a high bounce or spam complaint
                      rate. Please contact support.
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: WORKSPACE_SUSPENDED
        '404':
          description: The resource does not exist in this workspace.
          content:
            application/json:
              schema:
                type: object
                description: The resource does not exist in this workspace.
                properties:
                  statusCode:
                    type: number
                    example: 404
                  error:
                    type: string
                    example: Not Found
                  message:
                    type: string
                    example: Not found
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: NOT_FOUND
        '408':
          description: >-
            The request timed out. The outcome is unknown: a write may or may
            not have been applied. Read the resource back before retrying.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The request timed out. The outcome is unknown: a write may or
                  may not have been applied. Read the resource back before
                  retrying.
                properties:
                  statusCode:
                    type: number
                    example: 408
                  error:
                    type: string
                    example: Request Timeout
                  message:
                    type: string
                    example: An internal error occurred
        '409':
          description: >-
            The segment changed after the `expected_revision` you sent. Read it
            and retry.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The segment changed after the `expected_revision` you sent.
                  Read it and retry.
                properties:
                  statusCode:
                    type: number
                    example: 409
                  error:
                    type: string
                    example: Conflict
                  message:
                    type: string
                    example: The resource has changed. Reload it and try again.
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: CONFLICT
        '429':
          description: >-
            You have exceeded the rate limit. Please check the rate limit docs
            for more information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 429
                    examples:
                      - 429
                    example: 429
                  error:
                    type: string
                    enum:
                      - Too Many Requests
                    examples:
                      - Too Many Requests
                    example: Too Many Requests
                  message:
                    type: string
                    examples:
                      - Rate limit exceeded
                    example: Rate limit exceeded
                required:
                  - statusCode
                  - error
                  - message
        '500':
          description: >-
            An internal error occurred. The outcome is unknown: a write may or
            may not have been applied. Read the resource back before retrying.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  An internal error occurred. The outcome is unknown: a write
                  may or may not have been applied. Read the resource back
                  before retrying.
                properties:
                  statusCode:
                    type: number
                    example: 500
                  error:
                    type: string
                    example: Internal Server Error
                  message:
                    type: string
                    example: An internal error occurred
components:
  schemas:
    Segment:
      title: Segment
      description: >-
        A saved set of rules that selects contacts. Membership is worked out
        each time the segment is used. Optional fields with no value are left
        out of responses. Lists page with `cursor`: pass the previous page's
        `next_cursor` until there is none.
      x-tags:
        - Schemas
        - Segment
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the segment
          readOnly: true
          example: 0198a123-4567-7890-abcd-ef0123456789
        workspace_id:
          type: string
          description: Workspace that owns the segment
          readOnly: true
          example: 0198a123-4567-7890-abcd-ef0123456788
        name:
          type: string
          description: Name of the segment, up to 150 characters
          minLength: 1
          maxLength: 150
          example: Active trial users
        description:
          type:
            - 'null'
            - string
          description: Description, up to 500 characters, or null when unset
          minLength: 1
          maxLength: 500
          example: Signed up in the last 30 days
        definition:
          type: object
          description: >-
            Rules that select contacts. A contact matches when it matches every
            clause of at least one group. A definition that compiles to more
            than 4 KB gives 400; keep long value lists short.
          properties:
            groups:
              type: array
              minItems: 1
              maxItems: 5
              description: 1 to 5 groups. A contact matches when it matches any group.
              items:
                type: object
                properties:
                  clauses:
                    type: array
                    minItems: 1
                    maxItems: 5
                    items:
                      oneOf:
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - email
                                    - first_name
                                    - last_name
                                  examples:
                                    - email
                                  description: Contact field the clause tests
                                  example: email
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: string
                              maxLength: 256
                              examples:
                                - growth
                              example: growth
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - email
                                    - first_name
                                    - last_name
                                  examples:
                                    - email
                                  description: Contact field the clause tests
                                  example: email
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - contains
                                - not_contains
                                - starts_with
                              examples:
                                - contains
                              description: How the operand is compared
                              example: contains
                            value:
                              description: Value the operand is compared with
                              type: string
                              maxLength: 256
                              examples:
                                - growth
                              minLength: 1
                              example: growth
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - email
                                    - first_name
                                    - last_name
                                  examples:
                                    - email
                                  description: Contact field the clause tests
                                  example: email
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - exists
                                - not_exists
                              examples:
                                - exists
                              description: How the operand is compared
                              example: exists
                          required:
                            - operand
                            - operator
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - consent_status
                                  examples:
                                    - consent_status
                                  description: Contact field the clause tests
                                  example: consent_status
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: string
                              enum:
                                - never_consented
                                - subscribed
                                - unsubscribed
                              examples:
                                - never_consented
                              example: never_consented
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - delivery_status
                                  examples:
                                    - delivery_status
                                  description: Contact field the clause tests
                                  example: delivery_status
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: string
                              enum:
                                - deliverable
                                - hard_bounced
                                - complained
                                - suppressed
                              examples:
                                - deliverable
                              example: deliverable
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - origin
                                  examples:
                                    - origin
                                  description: Contact field the clause tests
                                  example: origin
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: string
                              enum:
                                - event
                                - import
                                - api
                                - sync
                              examples:
                                - event
                              example: event
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - created_at
                                    - updated_at
                                    - last_delivered_at
                                    - last_opened_at
                                    - last_clicked_at
                                  examples:
                                    - created_at
                                  description: Contact field the clause tests
                                  example: created_at
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - before
                                - after
                                - 'on'
                              examples:
                                - before
                              description: How the operand is compared
                              example: before
                            value:
                              description: Value the operand is compared with
                              type: string
                              format: date-time
                              examples:
                                - '2026-11-24T11:57:07.732Z'
                              example: '2026-11-24T11:57:07.732Z'
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - created_at
                                    - updated_at
                                    - last_delivered_at
                                    - last_opened_at
                                    - last_clicked_at
                                  examples:
                                    - created_at
                                  description: Contact field the clause tests
                                  example: created_at
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - within_last_days
                              examples:
                                - within_last_days
                              description: How the operand is compared
                              example: within_last_days
                            value:
                              description: Value the operand is compared with
                              type: integer
                              minimum: 1
                              maximum: 365
                              examples:
                                - 30
                              example: 30
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - created_at
                                    - updated_at
                                    - last_delivered_at
                                    - last_opened_at
                                    - last_clicked_at
                                  examples:
                                    - created_at
                                  description: Contact field the clause tests
                                  example: created_at
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - more_than_days_ago
                                - exactly_days_ago
                              examples:
                                - more_than_days_ago
                              description: How the operand is compared
                              example: more_than_days_ago
                            value:
                              description: Value the operand is compared with
                              type: integer
                              minimum: 0
                              maximum: 365
                              examples:
                                - 30
                              example: 30
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - created_at
                                    - updated_at
                                    - last_delivered_at
                                    - last_opened_at
                                    - last_clicked_at
                                  examples:
                                    - created_at
                                  description: Contact field the clause tests
                                  example: created_at
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - less_than_days_ago
                              examples:
                                - less_than_days_ago
                              description: How the operand is compared
                              example: less_than_days_ago
                            value:
                              description: Value the operand is compared with
                              type: integer
                              minimum: 1
                              maximum: 365
                              examples:
                                - 30
                              example: 30
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - created_at
                                    - updated_at
                                    - last_delivered_at
                                    - last_opened_at
                                    - last_clicked_at
                                  examples:
                                    - created_at
                                  description: Contact field the clause tests
                                  example: created_at
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - exists
                                - not_exists
                              examples:
                                - exists
                              description: How the operand is compared
                              example: exists
                          required:
                            - operand
                            - operator
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - custom_attribute
                                  examples:
                                    - custom_attribute
                                  description: Contact field the clause tests
                                  example: custom_attribute
                                key:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  examples:
                                    - plan
                                  description: Name of the custom attribute
                                  example: plan
                              required:
                                - field
                                - key
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: string
                              maxLength: 256
                              examples:
                                - growth
                              example: growth
                            value_type:
                              type: string
                              enum:
                                - string
                              examples:
                                - string
                              description: >-
                                Type of `value`, matching the type stored in the
                                custom attribute
                              example: string
                          required:
                            - operand
                            - operator
                            - value
                            - value_type
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - custom_attribute
                                  examples:
                                    - custom_attribute
                                  description: Contact field the clause tests
                                  example: custom_attribute
                                key:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  examples:
                                    - plan
                                  description: Name of the custom attribute
                                  example: plan
                              required:
                                - field
                                - key
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                                - greater_than
                                - less_than
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: number
                              examples:
                                - 10
                              example: 10
                            value_type:
                              type: string
                              enum:
                                - number
                              examples:
                                - number
                              description: >-
                                Type of `value`, matching the type stored in the
                                custom attribute
                              example: number
                          required:
                            - operand
                            - operator
                            - value
                            - value_type
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - custom_attribute
                                  examples:
                                    - custom_attribute
                                  description: Contact field the clause tests
                                  example: custom_attribute
                                key:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  examples:
                                    - plan
                                  description: Name of the custom attribute
                                  example: plan
                              required:
                                - field
                                - key
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - equals
                                - not_equals
                              examples:
                                - equals
                              description: How the operand is compared
                              example: equals
                            value:
                              description: Value the operand is compared with
                              type: boolean
                              examples:
                                - true
                              example: true
                            value_type:
                              type: string
                              enum:
                                - boolean
                              examples:
                                - boolean
                              description: >-
                                Type of `value`, matching the type stored in the
                                custom attribute
                              example: boolean
                          required:
                            - operand
                            - operator
                            - value
                            - value_type
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - custom_attribute
                                  examples:
                                    - custom_attribute
                                  description: Contact field the clause tests
                                  example: custom_attribute
                                key:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  examples:
                                    - plan
                                  description: Name of the custom attribute
                                  example: plan
                              required:
                                - field
                                - key
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - contains
                                - not_contains
                                - starts_with
                              examples:
                                - contains
                              description: How the operand is compared
                              example: contains
                            value:
                              description: Value the operand is compared with
                              type: string
                              maxLength: 256
                              examples:
                                - growth
                              minLength: 1
                              example: growth
                            value_type:
                              type: string
                              enum:
                                - string
                              examples:
                                - string
                              description: >-
                                Type of `value`, matching the type stored in the
                                custom attribute
                              example: string
                          required:
                            - operand
                            - operator
                            - value
                            - value_type
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - custom_attribute
                                  examples:
                                    - custom_attribute
                                  description: Contact field the clause tests
                                  example: custom_attribute
                                key:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  examples:
                                    - plan
                                  description: Name of the custom attribute
                                  example: plan
                              required:
                                - field
                                - key
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - exists
                                - not_exists
                              examples:
                                - exists
                              description: How the operand is compared
                              example: exists
                          required:
                            - operand
                            - operator
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - email_activity
                                  examples:
                                    - email_activity
                                  description: Contact field the clause tests
                                  example: email_activity
                                kind:
                                  type: string
                                  enum:
                                    - broadcast
                                  examples:
                                    - broadcast
                                  description: Kind of email the activity is on
                                  example: broadcast
                                broadcast_id:
                                  type: string
                                  minLength: 1
                                  maxLength: 100
                                  pattern: ^[^:\s]+$
                                  examples:
                                    - 0198a123-4567-7890-abcd-ef0123456789
                                  description: >-
                                    Broadcast whose email the contact delivered,
                                    opened or clicked
                                  example: 0198a123-4567-7890-abcd-ef0123456789
                                activity:
                                  type: string
                                  enum:
                                    - delivered
                                    - opened
                                    - clicked
                                  examples:
                                    - opened
                                  description: What the contact did with that email
                                  example: opened
                              required:
                                - field
                                - kind
                                - broadcast_id
                                - activity
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - exists
                                - not_exists
                              examples:
                                - exists
                              description: How the operand is compared
                              example: exists
                          required:
                            - operand
                            - operator
                          additionalProperties: false
                        - type: object
                          properties:
                            operand:
                              type: object
                              description: What the clause tests
                              properties:
                                field:
                                  type: string
                                  enum:
                                    - tag_ids
                                    - group_ids
                                  examples:
                                    - tag_ids
                                  description: Contact field the clause tests
                                  example: tag_ids
                              required:
                                - field
                              additionalProperties: false
                            operator:
                              type: string
                              enum:
                                - includes_any
                                - includes_all
                                - not_includes
                              examples:
                                - includes_any
                              description: How the operand is compared
                              example: includes_any
                            value:
                              description: Value the operand is compared with
                              type: array
                              minItems: 1
                              maxItems: 20
                              uniqueItems: true
                              items:
                                type: string
                                maxLength: 256
                                examples:
                                  - growth
                                minLength: 1
                                example: growth
                              examples:
                                - - tag-id
                              example:
                                - tag-id
                          required:
                            - operand
                            - operator
                            - value
                          additionalProperties: false
                    description: >-
                      1 to 5 clauses. A contact matches the group when it
                      matches every clause.
                required:
                  - clauses
                additionalProperties: false
            timezone:
              type: string
              minLength: 1
              maxLength: 100
              description: >-
                IANA time zone name used for day-based date clauses such as `on`
                and `within_last_days`. Defaults to UTC. An unknown zone gives
                400.
              example: Europe/Bucharest
          required:
            - groups
          additionalProperties: false
        segment_type:
          type: string
          description: 'Always `dynamic`: membership is worked out when the segment is used'
          readOnly: true
          enum:
            - dynamic
          example: dynamic
        schema_version:
          type: integer
          description: Version of the definition format
          readOnly: true
          enum:
            - 1
          example: 1
        revision:
          type: integer
          description: Current revision; send it as `expected_revision` when updating
          readOnly: true
          minimum: 1
          example: 1
        timestamp_created:
          type: string
          description: Timestamp when the segment was created
          readOnly: true
          format: date-time
          example: '2026-11-24T11:57:07.732Z'
        timestamp_updated:
          type: string
          description: Timestamp when the segment was last updated
          readOnly: true
          format: date-time
          example: '2026-11-24T11:57:07.732Z'
        created_by:
          type: string
          description: ID of the user who created the segment, or `api_key`
          readOnly: true
          example: 0198a123-4567-7890-abcd-ef0123456787
        updated_by:
          type: string
          description: ID of the user who last updated the segment, or `api_key`
          readOnly: true
          example: 0198a123-4567-7890-abcd-ef0123456787
      required:
        - id
        - workspace_id
        - name
        - description
        - definition
        - segment_type
        - schema_version
        - revision
        - timestamp_created
        - timestamp_updated
        - created_by
        - updated_by
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.