Create a dynamic segment on an asset
Create a dynamic segment scoped to a single asset. Requires the local_dynamic_segments permission. A user who cannot create a local segment in the builder cannot create one through this endpoint.
Identifying merge tags
A condition names the merge tag it tests by id, not by expression. Obtain ids from GET /merge-tags. Knak derives the platform expression and returns it as the read-only category field.
Operators
The operators available to a condition depend on its merge_tag_type. Four of them take no value at all, and sending one anyway is rejected.
| merge_tag_type | Operators | value |
|---|---|---|
| string | equals, not-equals, contains, not-contains, in, startsWith, not-startsWith, endsWith, not-endsWith, length-equals | Required, max 200 characters |
| string | hasContent, not-hasContent | Omit |
| number | equals, not-equals, greaterThan, greaterThanOrEqualTo, lessThan, lessThanOrEqualTo | Required |
| date | equals, not-equals, greaterThan, greaterThanOrEqualTo, lessThan, lessThanOrEqualTo | Required |
| relative_date | equals, not-equals, greaterThan, greaterThanOrEqualTo, lessThan, lessThanOrEqualTo | Required |
| boolean | isTrue, isFalse | Omit |
Limits
- 20 platform segments per request
- Condition sets nest 4 deep
- 20 conditions and 5 nested condition sets per condition set
- 200 characters per string value
Platform support
Only marketing_cloud is supported for segment conditional logic. Sending any other platform returns 422.
Atomicity
Every platform segment is validated before any is written, so a request that fails on its third entry leaves nothing behind.
Request
- Base URLhttps://enterprise.knak.io/api/published/v1
- Authnone declared
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
ID of asset. Must be an email; dynamic segments are only available on emails.
Request body
Example request
{
"name": "Canada - Enterprise",
"platform_dynamic_segments": [
{
"platform": "marketing_cloud",
"integration_id": "5f2c7a1b9e844",
"conditional_logic": {
"type": "condition_set",
"conjunction": "and",
"children": [
{
"type": "condition",
"merge_tag_id": "68b41c9f31f04",
"merge_tag_type": "string",
"operator": "equals"
}
]
}
}
]
}Response
Created
Changes
No recorded changes to this operation across all 1 revision of this API.