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", "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

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

string
conditions

At least one condition. Each condition is an object with a type and its value(s).

Array<object>
object
type
string
value
string
suppressionSegmentIds

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

Array<object>
object
channelSlugs

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

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

Successful response

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