The Segment API allows you to create, retrieve, manage, and delete dynamic contact segments for targeted messaging, automation workflows, and broadcast campaigns.
Segments help you group contacts based on filters, behavior, or engagement rules.
VIDEO GUIDE:
https://api.dmly.io/restAll endpoints require the x-api-key header:
x-api-key: YOUR_API_KEYGET /v1/segmentsRetrieve a list of segments with optional filtering and search.
Name | Type | Required | Description |
workspaceId | string | No | Filter by workspace ID |
limit | string | No | Maximum number of results |
page | string | No | Page number for pagination |
searchText | string | No | Free text search |
x-api-key | string | Yes (header) | API authentication key |
curl -X GET "https://api.dmly.io/rest/v1/segments?workspaceId=ws_123&page=1&limit=20" \
-H "x-api-key: YOUR_API_KEY"200 OK[
{
"id": "seg_001",
"name": "High Value Customers",
"type": "dynamic",
"status": "active",
"segments": [],
"retargetBroadcast": null,
"retargetEngagementType": null,
"scheduledDateTime": null,
"startedAt": null,
"completedAt": null
}
]POST /v1/segmentsCreate a new segment.
{
"name": "Inactive Contacts",
"type": "dynamic",
"status": "active"
}curl -X POST https://api.dmly.io/rest/v1/segments \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"name": "Inactive Contacts",
"type": "dynamic",
"status": "active"
}'200 OK{
"id": "seg_002",
"name": "Inactive Contacts",
"type": "dynamic",
"status": "active",
"segments": [],
"retargetBroadcast": null,
"retargetEngagementType": null,
"scheduledDateTime": null,
"startedAt": null,
"completedAt": null
}GET /v1/segments/{segmentId}Retrieve a segment using its unique ID.
Name | Type | Required | Description |
segmentId | string | Yes | Segment unique ID |
curl -X GET https://api.dmly.io/rest/v1/segments/seg_002 \
-H "x-api-key: YOUR_API_KEY"200 OK{
"id": "seg_002",
"name": "Inactive Contacts",
"type": "dynamic",
"status": "active",
"segments": [],
"retargetBroadcast": null,
"retargetEngagementType": null,
"scheduledDateTime": null,
"startedAt": null,
"completedAt": null
}DELETE /v1/segments/{segmentId}Delete a segment using its unique ID.
Name | Type | Required | Description |
segmentId | string | Yes | Segment unique ID |
curl -X DELETE https://api.dmly.io/rest/v1/segments/seg_002 \
-H "x-api-key: YOUR_API_KEY"200 OK{
"success": true
}{
"id": "string",
"name": "string",
"type": "string",
"status": "string",
"segments": [
{
"id": "string"
}
],
"retargetBroadcast": {
"id": "string"
},
"retargetEngagementType": "string",
"scheduledDateTime": "string",
"startedAt": "string",
"completedAt": "string"
}[
{
// Segment object
}
]{
"success": true
}Use pagination (page, limit) when listing segments.
Store segment IDs securely for broadcast and automation usage.
Avoid deleting segments currently attached to:
Broadcast campaigns
Automation workflows
Validate API key usage on server-side integrations only.
Monitor API rate limits.