curl --request PUT \
--url https://dash.dmly.io/api/v1/segments/{segment} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "VIP clients gone quiet (60d)",
"stage": "9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90",
"include_tags": [
"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31"
],
"exclude_tags": [],
"min_days_inactive": 60,
"conditions": {
"match": "all",
"groups": [
{
"match": "all",
"rules": [
{
"field": "lifecycle_stage",
"op": "equals",
"value": "client"
},
{
"field": "last_purchase",
"op": "older",
"value": "60"
}
]
}
]
}
}
'import requests
url = "https://dash.dmly.io/api/v1/segments/{segment}"
payload = {
"name": "VIP clients gone quiet (60d)",
"stage": "9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90",
"include_tags": ["3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31"],
"exclude_tags": [],
"min_days_inactive": 60,
"conditions": {
"match": "all",
"groups": [
{
"match": "all",
"rules": [
{
"field": "lifecycle_stage",
"op": "equals",
"value": "client"
},
{
"field": "last_purchase",
"op": "older",
"value": "60"
}
]
}
]
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'VIP clients gone quiet (60d)',
stage: '9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90',
include_tags: ['3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31'],
exclude_tags: [],
min_days_inactive: 60,
conditions: {
match: 'all',
groups: [
{
match: 'all',
rules: [
{field: 'lifecycle_stage', op: 'equals', value: 'client'},
{field: 'last_purchase', op: 'older', value: '60'}
]
}
]
}
})
};
fetch('https://dash.dmly.io/api/v1/segments/{segment}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/v1/segments/{segment}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'VIP clients gone quiet (60d)',
'stage' => '9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90',
'include_tags' => [
'3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31'
],
'exclude_tags' => [
],
'min_days_inactive' => 60,
'conditions' => [
'match' => 'all',
'groups' => [
[
'match' => 'all',
'rules' => [
[
'field' => 'lifecycle_stage',
'op' => 'equals',
'value' => 'client'
],
[
'field' => 'last_purchase',
'op' => 'older',
'value' => '60'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/segments/{segment}"
payload := strings.NewReader("{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://dash.dmly.io/api/v1/segments/{segment}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/segments/{segment}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Updates a segment by uuid. All fields are optional; only supplied fields are changed. Same validation rules as create (name max 80, stage uuid, tag uuid arrays, min_days_inactive >= 0, and the same conditions rule tree with its fields, operators and caps of 20 groups by 30 rules). Sending conditions REPLACES the stored tree; it is not merged. The same sanitising applies, so an unrecognised field or operator is dropped silently and the request still succeeds, and a tree in which nothing survives clears the segment’s conditions. conditions is still combined with the flat stage/tag/recency fields using AND, and is not returned in the response. Accepts PUT or PATCH.
curl --request PUT \
--url https://dash.dmly.io/api/v1/segments/{segment} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "VIP clients gone quiet (60d)",
"stage": "9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90",
"include_tags": [
"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31"
],
"exclude_tags": [],
"min_days_inactive": 60,
"conditions": {
"match": "all",
"groups": [
{
"match": "all",
"rules": [
{
"field": "lifecycle_stage",
"op": "equals",
"value": "client"
},
{
"field": "last_purchase",
"op": "older",
"value": "60"
}
]
}
]
}
}
'import requests
url = "https://dash.dmly.io/api/v1/segments/{segment}"
payload = {
"name": "VIP clients gone quiet (60d)",
"stage": "9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90",
"include_tags": ["3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31"],
"exclude_tags": [],
"min_days_inactive": 60,
"conditions": {
"match": "all",
"groups": [
{
"match": "all",
"rules": [
{
"field": "lifecycle_stage",
"op": "equals",
"value": "client"
},
{
"field": "last_purchase",
"op": "older",
"value": "60"
}
]
}
]
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'VIP clients gone quiet (60d)',
stage: '9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90',
include_tags: ['3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31'],
exclude_tags: [],
min_days_inactive: 60,
conditions: {
match: 'all',
groups: [
{
match: 'all',
rules: [
{field: 'lifecycle_stage', op: 'equals', value: 'client'},
{field: 'last_purchase', op: 'older', value: '60'}
]
}
]
}
})
};
fetch('https://dash.dmly.io/api/v1/segments/{segment}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/v1/segments/{segment}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'VIP clients gone quiet (60d)',
'stage' => '9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90',
'include_tags' => [
'3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31'
],
'exclude_tags' => [
],
'min_days_inactive' => 60,
'conditions' => [
'match' => 'all',
'groups' => [
[
'match' => 'all',
'rules' => [
[
'field' => 'lifecycle_stage',
'op' => 'equals',
'value' => 'client'
],
[
'field' => 'last_purchase',
'op' => 'older',
'value' => '60'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/segments/{segment}"
payload := strings.NewReader("{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://dash.dmly.io/api/v1/segments/{segment}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/segments/{segment}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"VIP clients gone quiet (60d)\",\n \"stage\": \"9b1d3f2a-7c4e-4a11-8f0a-2d6e5c4b1a90\",\n \"include_tags\": [\n \"3f8c1a02-9d44-4b6e-bb12-7a9e0c5d2f31\"\n ],\n \"exclude_tags\": [],\n \"min_days_inactive\": 60,\n \"conditions\": {\n \"match\": \"all\",\n \"groups\": [\n {\n \"match\": \"all\",\n \"rules\": [\n {\n \"field\": \"lifecycle_stage\",\n \"op\": \"equals\",\n \"value\": \"client\"\n },\n {\n \"field\": \"last_purchase\",\n \"op\": \"older\",\n \"value\": \"60\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
Your workspace API key. It both authenticates the caller and selects the workspace.
Path Parameters
Segment id.
Body
Response
Success.
Was this page helpful?

