Skip to content
Letterhead Letterhead Letterhead Help Center
Admin Tools

Create a segment

POST
/api/v3/contacts/segments
curl --request POST \
--url 'https://api.tryletterhead.com/api/v3/contacts/segments?api=true' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Engaged opens - last 30 days", "description": "Contacts who opened in the last 30 days", "criteria": { "matchMode": "all", "conditions": [ { "type": "tag", "operator": "has", "value": "engaged" } ], "suppressionSegmentIds": [] }, "channelSlugs": [] }'

Creates a company-level contact segment. A segment is a saved audience query; membership is never materialized — the criteria are evaluated live.

This is a company-level (v3) write. Authenticate with a company API key as a Bearer token.

Response

201 Created. The persisted segment is returned under items (see List segments for the segment shape). A duplicate name returns 409.

api
required
boolean

Required. Set to true.

Media type application/json
object
name
required

Segment name. Max 255 chars. Must be unique within the company.

string
description

Free-text description. Max 500 chars.

string
criteria
required

The saved query.

object
matchMode
required

all (AND the conditions) or any (OR the conditions).

string
conditions
required

At least one condition. The shape of each depends on its type — see the schemas below.

Array
One of:
customField
object
type
required
string
Allowed values: customField
customFieldKey
required

The custom field’s key (see List custom field definitions).

string
operator
required

=, >, <, >=, <=, inLastDays, notInLastDays, or isEmpty.

string
value

Comparison value. Omitted for the isEmpty operator, which carries no value. For inLastDays/notInLastDays, an integer number of days as a string.

string
suppressionSegmentIds

IDs of other segments (same company) whose members are excluded from this segment’s audience.

Array<integer>
channelSlugs

Channels to scope the segment to. Omit or send an empty array to make it available on every channel.

Array<string>
Example
{
"name": "Engaged opens - last 30 days",
"description": "Contacts who opened in the last 30 days",
"criteria": {
"matchMode": "all",
"conditions": [
{
"type": "tag",
"operator": "has",
"value": "engaged"
}
],
"suppressionSegmentIds": []
},
"channelSlugs": []
}

201 Created

Media type application/json
object
items
object
id

The segment’s identifier.

integer
name

The segment’s name (unique per company).

string
description

The segment’s description.

string
criteria
object
matchMode
string
conditions

At least one condition. The shape of each depends on its type — see the schemas below.

Array
One of:
customField
object
type
required
string
Allowed values: customField
customFieldKey
required

The custom field’s key (see List custom field definitions).

string
operator
required

=, >, <, >=, <=, inLastDays, notInLastDays, or isEmpty.

string
value

Comparison value. Omitted for the isEmpty operator, which carries no value. For inLastDays/notInLastDays, an integer number of days as a string.

string
suppressionSegmentIds

IDs of other segments (same company) whose members are excluded from this segment’s audience.

Array<integer>
channelSlugs

Channels the segment is scoped to. An empty array means it is available on every channel.

Array<string>
createdAt

Creation timestamp.

string
updatedAt

Last-updated timestamp.

string
message
string
total
integer
Example
{
"items": {
"id": 9,
"name": "Engaged opens - last 30 days",
"description": "Contacts who opened in the last 30 days",
"criteria": {
"matchMode": "all",
"conditions": [
{
"type": "tag",
"operator": "has",
"value": "engaged"
}
],
"suppressionSegmentIds": []
},
"channelSlugs": [],
"createdAt": "2026-06-20 12:00:00",
"updatedAt": "2026-06-20 12:00:00"
},
"message": "Segment created.",
"total": 1
}

Still can’t find what you need? Contact support.