Skip to main content
POST
/
audience
/
segments
Create a segment
curl --request POST \
  --url https://app.lettr.com/api/audience/segments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Engaged subscribers",
  "conditions": {
    "groups": [
      {
        "conditions": [
          {
            "field": "email",
            "operator": "equals",
            "value": "@example.com"
          }
        ]
      }
    ]
  },
  "list_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'
{
  "message": "Segment retrieved successfully.",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "Engaged subscribers",
    "list_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "list_name": "<string>",
    "condition_groups": [
      {
        "conditions": [
          {
            "field": "email",
            "operator": "equals",
            "value": "@example.com"
          }
        ]
      }
    ],
    "cached_contacts_count": 1,
    "created_at": "2023-11-07T05:31:56Z"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

Create a segment defined by condition groups (conditions within a group are joined by OR; groups are joined by AND). Requires the audience:write scope and is blocked for sandbox API keys.

Authorizations

Authorization
string
header
required

API key for authentication

Body

application/json
name
string
required
Maximum string length: 255
Example:

"Engaged subscribers"

conditions
object
required
list_id
string<uuid> | null

Restrict segment to a single list. Must belong to the authenticated team.

Response

Segment created

message
string
required
Example:

"Segment retrieved successfully."

data
object
required