Segments
Update segment
PATCH
/
v1
/
segments
/
{segmentId}
cURL
curl --request PATCH \
--url https://app.getozi.com/api/v1/segments/{segmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rules": [
{
"kind": "field",
"value": ""
}
]
}
'import requests
url = "https://app.getozi.com/api/v1/segments/{segmentId}"
payload = {
"name": "<string>",
"rules": [
{
"kind": "field",
"value": ""
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', rules: [{kind: 'field', value: ''}]})
};
fetch('https://app.getozi.com/api/v1/segments/{segmentId}', 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://app.getozi.com/api/v1/segments/{segmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rules' => [
[
'kind' => 'field',
'value' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.getozi.com/api/v1/segments/{segmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.getozi.com/api/v1/segments/{segmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getozi.com/api/v1/segments/{segmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"contactBookId": "<string>",
"name": "<string>",
"match": "ALL",
"rules": [
{
"kind": "field",
"field": "email",
"operator": "is",
"value": ""
}
],
"createdAt": "<string>",
"updatedAt": "<string>",
"_count": {
"campaigns": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Renames a segment or changes its rules. Only the fields you send change. Campaigns using it pick up the new rules when they send.
Needs an API key with full access. Not available to a key limited to one domain.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Example:
"clx1234567890"
Body
application/json
Response
The updated segment
ALL: a contact must match every rule. ANY: one rule is enough.
Available options:
ALL, ANY - Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
How many campaigns use the segment (list only)
Show child attributes
Show child attributes
⌘I
cURL
curl --request PATCH \
--url https://app.getozi.com/api/v1/segments/{segmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rules": [
{
"kind": "field",
"value": ""
}
]
}
'import requests
url = "https://app.getozi.com/api/v1/segments/{segmentId}"
payload = {
"name": "<string>",
"rules": [
{
"kind": "field",
"value": ""
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', rules: [{kind: 'field', value: ''}]})
};
fetch('https://app.getozi.com/api/v1/segments/{segmentId}', 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://app.getozi.com/api/v1/segments/{segmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rules' => [
[
'kind' => 'field',
'value' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.getozi.com/api/v1/segments/{segmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.getozi.com/api/v1/segments/{segmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getozi.com/api/v1/segments/{segmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"kind\": \"field\",\n \"value\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"contactBookId": "<string>",
"name": "<string>",
"match": "ALL",
"rules": [
{
"kind": "field",
"field": "email",
"operator": "is",
"value": ""
}
],
"createdAt": "<string>",
"updatedAt": "<string>",
"_count": {
"campaigns": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}