---
title: "Update a segment"
method: PUT
path: "/1/newsletters/{domain}/segments/{segment}"
tags: ["Segments"]
---

# Update a segment

`PUT /1/newsletters/{domain}/segments/{segment}`

Update a segment with new values.

## Path parameters

- `domain` integer, required
- `segment` integer, required

## Request body

- object
  - `data` object, nullable
    - `closure` 'OR' — Defines the logical operator applied to the conditions array (conds) <br> "OR" means at least one condition must match
    - `conds` object[]
      - `closure` 'AND', required — Logical operator for nested conditions <br> "AND" means all inner conditions must match
      - `conds` object[], required
        - `actionId` 'all' | 'any' | 'custom' | 'last5' — Defines which campaigns to consider.<br><ul><li><strong>all</strong>: any campaign ever</li><li><strong>any</strong>: any campaign in the last 30 days</li><li><strong>last5</strong>: one of the last 5 campaigns</li><li><strong>custom</strong>: a specific campaign (requires campaign_id)</li></ul><em>Required only when type = "campaign"</em>
        - `campaign_id` integer — ID of the specific campaign to check.<br><em>Required only if actionId = "custom"</em><br>
        - `date1` string — Start date for subscription date filter (format: Y-m-d).<br><em>Required when type = "created_at"</em>
        - `date2` string, nullable — End date for date range filtering.<br><em>Required only when operator = "between"</em><br><em>Must be after or equal to date1</em><br>
        - `mailinglist_id` integer — ID of the mailing list to check subscription status.<br><em>Required when type = "mailinglist"</em>
        - `meta_id` integer — ID of the subscriber custom field (meta field).<br><em>Required when type = "meta"</em>
        - `operator` '<' | '<>' | '=' | '>' | 'between' | 'click' | 'exclude' | 'finish' | 'include' | 'like' | 'noclick' | 'noopen' | 'nosent' | 'not like' | 'open' | 'sent' | 'start', required — Logical operator for the condition, varies by type:<br><ul><li><strong>campaign:</strong> "open", "click", "sent", "noopen", "noclick", "nosent"</li><li><strong>created_at:</strong> "=", ">", "<", "between"</li><li><strong>meta:</strong> "=", "<>", "like", "not like", "start", "finish"</li><li><strong>mailinglist:</strong> "include", "exclude"</li></ul>
        - `type` 'campaign' | 'created_at' | 'mailinglist' | 'meta', required
        - `value` string — Value to compare against the meta field.<br>Used with operators like "=", "like", etc.<br><em>Required when type = "meta"</em>
  - `name` string — Name of the resource `{name}`

## Response `200`

OK

- object
  - `result` 'success' | 'error' | 'asynchronous', required — Result of the HTTP request
  - `data` 78d6c681Segment
    - `id` integer, required — Unique identifier of the resource `Segment`
    - `name` string, required — Name of the resource `Segment`
    - `data` unknown[]
      - unknown
    - `subscribed_count` integer, required
    - `updated_at` integer, required — Timestamp `Segment` has been updated
    - `statistics` object

---

[API](https://skmtc.dev/infomaniak/apis/api-reference-developer-tools.md) · [All operations](https://skmtc.dev/infomaniak/apis/api-reference-developer-tools/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/infomaniak/api-reference-developer-tools/revisions/667aae28fec6/schema)
