Change a segment
const url = 'https://digize.com/api/v1/newsletter/segments/example';const options = { method: 'PATCH', headers: { 'Idempotency-Key': '5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69', 'x-api-key': '<x-api-key>', 'Content-Type': 'application/json' }, body: '{"name":"example","description":"example","filter":{"search":"example","stage":["lead"],"source":["checkout"],"ownerId":["example"],"tag":["example"],"tagMode":"any","excludeTag":["example"],"companyId":"example","fields":{"additionalProperty":["example"]},"conditions":[{"key":"example","op":"is","value":"example"}],"scoreMin":1,"scoreMax":1,"activeWithinDays":1,"inactiveForDays":1,"createdWithinDays":1,"newsletter":[{"kind":"status","in":["pending"]}]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://digize.com/api/v1/newsletter/segments/example \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \ --header 'x-api-key: <x-api-key>' \ --data '{ "name": "example", "description": "example", "filter": { "search": "example", "stage": [ "lead" ], "source": [ "checkout" ], "ownerId": [ "example" ], "tag": [ "example" ], "tagMode": "any", "excludeTag": [ "example" ], "companyId": "example", "fields": { "additionalProperty": [ "example" ] }, "conditions": [ { "key": "example", "op": "is", "value": "example" } ], "scoreMin": 1, "scoreMax": 1, "activeWithinDays": 1, "inactiveForDays": 1, "createdWithinDays": 1, "newsletter": [ { "kind": "status", "in": [ "pending" ] } ] } }'Renames a segment, changes its description, or a smart one’s filter. Its kind stays.
Needs the newsletter:write permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.
Example
5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69Request Bodyrequired
Section titled “Request Bodyrequired”object
Who the segment takes: any of crm.contacts.list’s filters and newsletter conditions, all of which must hold.
object
Whether a contact needs any of the tags (the default) or all of them.
Leaves out contacts with any of these tags.
Dropdown fields’ options to match, by field key.
object
Lead score at least this.
Lead score at most this.
Something happened with them in the last this many days.
Nothing has happened with them for at least this many days.
Newsletter conditions, all of which must hold: subscription state, engagement stars, opened or clicked lately, signup source, form, UTM tag, country.
object
Their subscription is in one of these states; none for contacts never on the list.
object
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
object
Form ids, as a subscriber’s formId names them.
object
Their signup’s UTM tag is one of these, ignoring case.
object
ISO 3166-1 alpha-2 codes, such as US.
object
Subscribed in the last this many days.
Subscribed more than this many days ago.
object
object
free for free readers, paid for any paid tier, or a tier’s id (nlt_…): they read at one of these now.
object
The poll, nlp_….
The answer they picked, by its place (0 first); left out, any answer.
The poll’s question, kept for the segment’s summary.
The answer’s words, kept for the summary.
Responses
Section titled “Responses”Done
object
Smart: whoever matches its filter now; static: the contacts added to it.
object
Whether a contact needs any of the tags (the default) or all of them.
Leaves out contacts with any of these tags.
Dropdown fields’ options to match, by field key.
object
Lead score at least this.
Lead score at most this.
Something happened with them in the last this many days.
Nothing has happened with them for at least this many days.
Only the contacts in this list.
Newsletter conditions, all of which must hold: subscription state, engagement stars, opened or clicked lately, signup source, form, UTM tag, country.
object
Their subscription is in one of these states; none for contacts never on the list.
object
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
How many of the workspace’s latest posts that went out (more than 50 counts as 50), or days.
posts: the latest posts that went out; days: days.
object
object
Form ids, as a subscriber’s formId names them.
object
Their signup’s UTM tag is one of these, ignoring case.
object
ISO 3166-1 alpha-2 codes, such as US.
object
Subscribed in the last this many days.
Subscribed more than this many days ago.
object
object
free for free readers, paid for any paid tier, or a tier’s id (nlt_…): they read at one of these now.
object
The poll, nlp_….
The answer they picked, by its place (0 first); left out, any answer.
The poll’s question, kept for the segment’s summary.
The answer’s words, kept for the summary.
How many contacts it holds now.
Of its contacts, those subscribed now: who a post to it goes to, before suppressions.
Example
{ "kind": "smart", "filter": { "stage": [ "lead" ], "source": [ "checkout" ], "tagMode": "any", "conditions": [ { "op": "is" } ], "newsletter": [ { "kind": "status", "in": [ "pending" ] } ] }}What was sent isn’t valid (invalid).
object
object
object
Example
{ "error": { "code": "invalid" }}No key, or one that’s unknown, off or expired.
object
object
object
Example
{ "error": { "code": "invalid" }}The key doesn’t have the permission this needs.
object
object
object
Example
{ "error": { "code": "invalid" }}Nothing has that id (not_found).
object
object
object
Example
{ "error": { "code": "invalid" }}A request with the same Idempotency-Key is still running (conflict).
object
object
object
Example
{ "error": { "code": "invalid" }}The Idempotency-Key was used with a different request.
object
object
object
Example
{ "error": { "code": "invalid" }}Over the rate limit; see retry-after.
object
object
object
Example
{ "error": { "code": "invalid" }}