Update a segment
Change a segment's name, description or definition.
PATCH
https://app.usenotix.dev/api/v1/contactBooks/{contactBookId}/segments/{segmentId}Needs a full access key. Sending access keys cannot call this. Key permissions lists the extra rules some calls have.
Change a segment's name, description or definition. A segment that a scheduled or running campaign, or an active journey, uses can be renamed but not redefined.
Path parameters
contactBookIdstringrequired
segmentIdstringrequired
Body parameters
namestring
At most 80 characters.
descriptionstring
At most 280 characters. Can be null.
definitionobject
definition.versionnumberrequired
One of 1.
definition.matchstringrequired
One of all, any.
definition.conditionsobject[]required
Headers
Authorizationstringrequired
Bearer followed by your API key.
Errors
400
The definition is not valid, or a live campaign or journey uses the segment and the definition changed.
404
No segment with this id in the contact book for the calling team.
409
Another segment in the contact book already has this name.
Every error has the same shape. See all error codes.
curl -X PATCH "https://app.usenotix.dev/api/v1/contactBooks/<contactBookId>/segments/<segmentId>" \
-H "Authorization: Bearer $NOTIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Engaged Pro users (30 days)"
}'
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY);
const { data, error } = await notix.segments.update("cb_123", "seg_123", { name: "Engaged Pro and Team users" });
from notix import Notix
notix = Notix() # reads NOTIX_API_KEY
segment, _ = notix.segments.update("cb_123", "seg_123", {"name": "Engaged Pro and Team users"})
use Notix\Notix;
$notix = new Notix(getenv('NOTIX_API_KEY'));
$segment = $notix->segments->update('cb_123', 'seg_123', ['name' => 'Engaged Pro and Team users']);
Response200
{
"id": "cm1x8f3k20001qz7v5b9d2e4a",
"contactBookId": "cm1x8f3k20001qz7v5b9d2e4a",
"name": "Acme",
"description": "string",
"definition": {
"version": 1,
"match": "all",
"conditions": [
{
"type": null,
"match": null,
"conditions": null
}
]
},
"count": 1,
"problems": [
"string"
],
"createdAt": "string",
"updatedAt": "string"
}