Create segment

Creates a segment with a name and, for a dynamic one, filters.

POST https://cotlet.dev/api/v1/mautic/segments

write Confirm

Creates a segment as the New button on Segments does. With filters it is dynamic: each filter is a field, an operator and a value, joined with and or or. A field appears as a filter only when it has Available for Segments set to Yes in the custom field settings. Without filters the segment is static and starts empty. A new segment reaches nobody, but it can feed a campaign. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: create_segment
NameTypeDescription
name string required string Segment name.
description string string Description shown in the segment list.
filters array array Filters as objects with field, operator, value and glue (and or or).

Request

cURL
curl -X POST https://cotlet.dev/api/v1/mautic/segments \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Jane Doe"}'
Python
result = client.call("mautic", "create_segment", {"name":"Jane Doe"})
Node.js
const result = await cotlet.call('mautic', 'create_segment', {"name":"Jane Doe"});
CLI
cotlet call mautic create_segment --data '{"name":"Jane Doe"}'

Example response

JSON

{
  "segment_id": 9,
  "name": "Inactive 90 days",
  "alias": "inactive-90-days",
  "type": "dynamic",
  "active": true
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.