Skip to content

Tags, lists & segments

Group contacts three ways — labels, fixed lists and live rules — and describe them with custom attributes. Campaign audiences are built from these.

Endpoints

Tags

Tags are labels such as VIP or Diwali-2026. Contacts can carry many. Add them by name when creating a contact (missing tags are created), or by id with POST /v1/contacts/{id}/tags and POST /v1/contacts/bulk. Adding and removing tags fires contact.tag_added and contact.tag_removed.

Lists

Lists are fixed groups you manage yourself — for example, everyone who attended an event. Add and remove members by contact id; the CSV import can also put every imported contact into a list.

Segments

Segments are saved rules evaluated whenever they're used, so a campaign to a segment always reaches whoever matches at send time. Try rules with POST /v1/segments/preview before saving.

POST /v1/segments
{
  "name": "Engaged VIPs in Bengaluru",
  "rules": {
    "op": "and",
    "conditions": [
      { "field": "tag", "operator": "in", "value": ["7f3a…"] },
      { "field": "attribute.city", "operator": "eq", "value": "Bengaluru" },
      { "field": "last_inbound_at", "operator": "within_days", "value": 30 }
    ]
  }
}
PartValues
opand or or. A condition can itself be a group with its own op and conditions (up to 3 levels, 30 conditions per group).
fieldtag, list (values are ids), opt_in, country, name, phone, email, username, created_at, last_inbound_at, last_outbound_at, attribute.<key>
operatoreq, neq, in, not_in, contains, exists, not_exists, gt, gte, lt, lte, within_days, older_than_days

Custom attributes

Define the extra fields your contacts carry — city, plan, last order value — and fill them through attributes on the contact, CSV import (attribute.<key>) or automations. Up to 100 per organization.

POST /v1/contact-attributes
{
  "key": "tier",
  "label": "Loyalty tier",
  "kind": "enum",
  "options": ["silver", "gold", "platinum"]
}

kind is text, number, date, boolean or enum. The key can't be changed later.

Something unclear or missing on this page? Tell us at contact@swastik.ai