Skip to main content
POST
Update segment
Use this endpoint to update a segment’s name, description, audience, filters, tags, or status. Passing status: 2 soft-deletes the segment.

Endpoint

POST /segment/update Content-Type: application/json Authentication: Required (workspace auth)

Request Body

Update fields

Soft-delete

Response

When status: 2 is passed:

Behavior

  • segment_id must be an existing, non-deleted segment owned by the caller’s company/workspace — you cannot use this endpoint to “undelete” a segment.
  • Renaming checks name-uniqueness against other non-deleted segments in the workspace (skipped while soft-deleting).
  • Changing audience_id re-validates ownership of the new audience via the same check used by Create Segment and Preview Segment.
  • Sending conditions/filter_conditions or match_type re-parses and stores the filter in the flat { match_type, conditions: [...] } shape — this replaces (and is a different shape from) the CONDITIONLIST tree that Create Segment writes.
  • When the audience or filter actually changed (and the request isn’t a delete), total_contacts is recomputed by evaluating the new filter against the (possibly new) audience’s contacts in memory.
Recomputing total_contacts here only updates the cached count — it does not re-materialize the segment’s underlying contact mapping. List Segment Contacts, Export Segment Contacts, and any campaign already attached to this segment keep dialing/reading the contact set that was materialized at Create Segment time, until the segment is deleted and a new one is created in its place.

Error Cases

Example cURL

Headers

token
string
required

API token for authentication

Body

application/json
segment_id
integer
required

Segment identifier

segment_name
string

New name. Must be unique within the workspace (among non-deleted segments, excluding this one).

description
string
audience_id
integer

Re-scope the segment to a different audience.

conditions
object[]

New filter, flat format. Alias: filter_conditions.

match_type
enum<string>
Available options:
all,
any
tags
string[]
status
enum<integer>

0 = Inactive, 1 = Active, 2 = Deleted (soft-delete)

Available options:
0,
1,
2

Response

Segment updated (or deleted) successfully

message
string
data
object