API reference

Lists and segments

Subscription lists, saved filters and the segment definition format

Lists and Segments explained. To subscribe a contact to a list, see Contacts.

Lists

The list object

{
  "id": "5a8e2c1f-0b3d-4e6a-9f7c-2d1e8b4a6c3f",
  "name": "Product updates",
  "description": "New features, once a month",
  "isPublic": true,
  "fromEmail": "news@acme.com",
  "fromName": "Acme",
  "counts": { "subscribed": 4210, "active": 4192, "inactive": 18, "pending": 37, "unsubscribed": 158 },
  "createdAt": "2026-09-01T08:00:00Z",
  "updatedAt": "2026-09-01T08:00:00Z"
}

isPublic lists appear on the preferences page. fromEmail and fromName send the double opt-in confirmation of the list; null uses the default sender of the space.

Every endpoint that returns a list includes counts, computed at request time.

CountContacts
subscribedSubscribed to the list, active or not
activeSubscribed and able to receive
inactiveSubscribed, but their address hard bounced: they receive nothing
pendingAwaiting double opt-in confirmation. Unconfirmed after 30 days, they are removed
unsubscribedLeft the list

List lists

GET /v1/lists

Every list of the space, with its counts.

curl https://api.kulamail.com/v1/lists \
  -H "Authorization: Bearer ml_your_api_key"

Create a list

POST /v1/lists

name
string required
120 characters at most. Contacts see it on the preferences page.
description
string
500 characters at most.
isPublic
boolean
Show the list on the preferences page. Default true.
fromEmail
string
Sender of the confirmation email, on a verified domain of the space. Otherwise 400domain_not_verified. Default: the sender of the space.
fromName
string
Sender name of the confirmation email. Default: the sender name of the space.
curl https://api.kulamail.com/v1/lists \
  -H "Authorization: Bearer ml_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Product updates", "description": "New features, once a month" }'

Returns 201 with the list object.

Get, update and delete a list

  • GET /v1/lists/{id} returns the list with its counts.
  • PATCH /v1/lists/{id} changes name, description, isPublic, fromEmail or fromName. Fields left out stay as they are; an empty description, fromEmail or fromName clears it.
  • DELETE /v1/lists/{id} deletes the list and its subscriptions. The contacts stay. Answers 204.

Subscriber growth

GET /v1/lists/{id}/stats for a list, GET /v1/lists/stats for the space. For the space, a subscriber is a contact subscribed to at least one list, counted once.

from
string
First day, YYYY-MM-DD. Default: 29 days before to.
to
string
Last day, included. Default: today. A range covers 366 days at most.
curl "https://api.kulamail.com/v1/lists/5a8e2c1f-0b3d-4e6a-9f7c-2d1e8b4a6c3f/stats?from=2026-09-01&to=2026-09-30"   -H "Authorization: Bearer ml_your_api_key"
{
  "listId": "5a8e2c1f-0b3d-4e6a-9f7c-2d1e8b4a6c3f",
  "from": "2026-09-01",
  "to": "2026-09-30",
  "timezone": "Europe/Paris",
  "period": {
    "subscribed": 12,
    "unsubscribed": 2,
    "deactivated": 1,
    "net": 10,
    "unsubscribedByReason": { "USER": 1, "COMPLAINT": 1 }
  },
  "days": [
    { "date": "2026-09-01", "subscribed": 1, "unsubscribed": 0, "deactivated": 0, "total": 172, "active": 170 }
  ]
}

Days follow the time zone of the space, and every day of the range is present, with zeros when nothing moved.

FieldMeaning
subscribedJoined, whatever the way in: form, API, import or dashboard
unsubscribedLeft, whatever the reason
deactivatedHard bounced: still subscribed, now inactive
totalSubscribers at the end of the day, active or not
activeSubscribers at the end of the day who can receive
unsubscribedByReasonUSER (unsubscribe link or preferences page), API, DASHBOARD, COMPLAINT, INACTIVE (cleaned up for inactivity) or DELETED (contact deleted)

To compare with the previous period, call the same endpoint on the preceding range. With to set to today, the last day carries the current counts.

Segments

The segment object

{
  "id": "7b6a5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
  "name": "Engaged pro users",
  "description": null,
  "definition": {
    "match": "all",
    "conditions": [
      { "type": "attribute", "key": "plan", "operator": "equals", "value": "pro" },
      { "type": "activity", "operator": "opened", "withinDays": 30 }
    ]
  },
  "contactCount": 812,
  "activeContactCount": 790,
  "createdAt": "2026-10-01T12:00:00Z",
  "updatedAt": "2026-10-01T12:00:00Z"
}

contactCount counts contacts matching now, whatever their status; activeContactCount only those who can still receive email.

List segments

GET /v1/segments

Create a segment

POST /v1/segments

name
string required
120 characters at most.
description
string
500 characters at most.
definition
object required
The filter. See Segment definition.
curl https://api.kulamail.com/v1/segments \
  -H "Authorization: Bearer ml_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Trial users who did not activate",
    "definition": {
      "match": "all",
      "conditions": [
        { "type": "attribute", "key": "plan", "operator": "equals", "value": "trial" },
        { "type": "event", "name": "project_created", "operator": "not_performed" }
      ]
    }
  }'

Returns 201 with the segment object, or 400 with a message naming the invalid condition.

Get, update and delete a segment

  • GET /v1/segments/{id} returns the segment.
  • PATCH /v1/segments/{id} changes name, description or definition. Fields left out stay as they are.
  • DELETE /v1/segments/{id} answers 204, or 409 segment_in_use while a scheduled or sending campaign uses the segment.

Segment definition

A definition combines up to 50 conditions:

{
  "match": "all",
  "conditions": [ ... ]
}

match is all (every condition must hold) or any (at least one). A definition with no condition matches every contact.

Each condition has a type: attribute, field, list, event or activity. Flow conditions also take trigger_event.

Attribute

Filters on a contact attribute.

{ "type": "attribute", "key": "seats", "operator": "greater_than", "value": 10 }
OperatorValue
equals, not_equalsA string, number or boolean
contains, not_containsA string
greater_than, less_thanA number
before, afterAn ISO 8601 date, such as 2026-01-31 (UTC when no time zone)
is_true, is_falseNone
exists, not_existsNone

Field

Filters on a built-in contact field.

{ "type": "field", "field": "mailbox_provider", "operator": "equals", "value": "GOOGLE" }
FieldOperatorsValue
emailequals, not_equals, contains, not_containsA string
first_name, last_nameequals, not_equals, contains, not_contains, exists, not_existsA string
created_atbefore, afterAn ISO 8601 date
mailbox_providerequals, not_equalsGOOGLE, MICROSOFT, YAHOO, AOL, APPLE, OTHER, UNKNOWN
sourceequals, not_equalsFORM, API, IMPORT, DASHBOARD, MCP

List

Filters on a list subscription.

{ "type": "list", "listId": "5a8e2c1f-0b3d-4e6a-9f7c-2d1e8b4a6c3f", "operator": "not_subscribed" }

Operators: subscribed, not_subscribed.

Event

Filters on events the contact performed.

{ "type": "event", "name": "order_paid", "operator": "performed", "withinDays": 30 }

Operators: performed, not_performed. Optional withinDays (1 to 3650) limits the check to the last days; without it, any time counts.

Optional where keeps the events whose properties match, 5 filters at most. Each has a key (a property, or a dotted path such as items.0.name), an operator and a value, with the operators and the loose comparison of a trigger event rule:

{
  "type": "event", "name": "kula.resource_downloaded", "operator": "performed", "withinDays": 30,
  "where": [{ "key": "form_id", "operator": "equals", "value": "3f2a9c1e-7b4d-4e8a-a6c2-1d9e5b7f0a34" }]
}

The events of Kula carry the id of the form.

Activity

Filters on emails the contact received, opened or clicked.

{ "type": "activity", "operator": "not_opened", "withinDays": 90 }

Operators: received, not_received, opened, not_opened, clicked, not_clicked. Optional withinDays (1 to 3650), and campaignId (one campaign only) or flowStepId (one email step of a flow, every run counts), not both. Opens and clicks by privacy proxies and link scanners don't count.

inactive matches contacts who received an email more than withinDays ago and haven't opened or clicked since. Contacts whose emails Apple Mail opened in that time are left out, since Apple opens every email itself. withinDays is required, campaignId isn't accepted.

{ "type": "activity", "operator": "inactive", "withinDays": 180 }

Trigger event

In the CONDITION and SPLIT steps of a flow triggered by an event only: filters on a property of the event that started the run.

{ "type": "trigger_event", "key": "newsletter_enabled", "operator": "is_false" }

key is the property, with dots for nested ones (blog.plan, items.0.name). Operators and values are those of attribute conditions; a missing property is not set and false. A segment refuses it (400), and a flow triggered by a list can't be activated with it.

Examples

Inactive subscribers, to clean your list:

{
  "match": "all",
  "conditions": [
    { "type": "activity", "operator": "received", "withinDays": 90 },
    { "type": "activity", "operator": "not_opened", "withinDays": 90 }
  ]
}

Customers on either paid plan:

{
  "match": "any",
  "conditions": [
    { "type": "attribute", "key": "plan", "operator": "equals", "value": "pro" },
    { "type": "attribute", "key": "plan", "operator": "equals", "value": "business" }
  ]
}