Create segment
Creates a segment with a name and, for a dynamic one, filters.
POST https://cotlet.dev/api/v1/mautic/segments
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
| Name | Type | Description |
|---|---|---|
| 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 -X POST https://cotlet.dev/api/v1/mautic/segments \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Jane Doe"}' result = client.call("mautic", "create_segment", {"name":"Jane Doe"}) const result = await cotlet.call('mautic', 'create_segment', {"name":"Jane Doe"}); cotlet call mautic create_segment --data '{"name":"Jane Doe"}' Example response
{
"segment_id": 9,
"name": "Inactive 90 days",
"alias": "inactive-90-days",
"type": "dynamic",
"active": true
}