Mail API reference

Mail API · Segments

patch/v1/workspaces/{workspace_id}/segments/{segment_id}Auth

Update a segment

Rename it, or change a rule segment's rule. A segment's type (static or rule) is fixed.

Path parameters

workspace_id*string · uuid

Id of the workspace.

segment_id*string · uuid

Id of the segment.

Headers

Idempotency-Keystring

Opaque client-generated string (1–256 chars, `[A-Za-z0-9._:-]`) used to deduplicate retries within a 24h window. A retry with the same key and body returns the original response with `Idempotent-Replay: true`.

Request body

namestring

New name of the segment.

descriptionstring

New description; null clears it.

ruleobject

A new rule (rule segments only; a static segment cannot take one).

Response · 200

id*string · uuid

The segment id.

name*string

Name of the segment.

Example: "Pro customers"

description*string

Optional description of who is in the segment.

type*object

`static`: an explicit member list. `rule`: the contacts matching `rule`.

rule*object

Null for a static segment.

created_at*string · date-time

When the segment was created.

updated_at*string · date-time

When the segment was last changed.

Example

Request

PATCH https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/segments/{segment_id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "name": "string",
  "description": "string",
  "rule": {}
}

Response

{
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "Pro customers",
  "description": "string",
  "type": {},
  "rule": {},
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}