Lists all templates available for segment creation. Returned templated definitions include the required user
input which will then be interpolated into the templated attributes and segment definition in order to
create the needed resources. See the applyTemplate endpoint for more details on how to.
[- {
- "id": "new_to_brand",
- "name": "New to Brand",
- "userInput": {
- "brand": {
- "type": "string"
}, - "days": {
- "type": "int"
}
}, - "attributes": [
- {
- "key": "new_to_brand_attribute",
- "name": "New to {{brand}}",
- "matchRule": "meta[\"type\"] == \"orderPlace\" && exists(x:views[\"products\"], x[\"brand\"] == \"{{brand}}\")",
- "attrPaths": [
- "$.meta.timestampMillis"
], - "aggregation": {
- "type": "most-recent"
}, - "periodDays": "{{days}}"
}
], - "segment": {
- "name": "New to {{brand}}",
- "description": "Customers who are entering the brand for the first time or re-engaging after a long absence",
- "category": "New buyer",
- "rule": "not({{keys.new_to_brand_attribute}} after {{days}} days ago)"
}
}
]Creates or reuses a segment and the respective attributes that feed it by applying user input to the template with the ID specified in the endpoint's path. The network ID is also required in order for the segment to be associated with the Kevel Native Segments destination for that network.
The response contains the ID of the created or reused segment, along with the template that was used.
| id required | string The template ID to use for segment creation. |
| networkId required | integer <int32> The network ID to associate the segment with in the respective KevelNativeSegments destination. |
| advertiserId required | integer <int64> The ID of the advertiser creating this segment. |
required | object (Map_Json) Map of user inputs to interpolate into the template. These will be validated in accordance with the expected type attributed to the input in the template's definition. |
{- "networkId": 10000,
- "advertiserId": 2712478,
- "userInputs": {
- "brand": "Kevel",
- "days": 5
}
}{- "segmentId": 0,
- "template": {
- "id": "new_to_brand",
- "name": "New to Brand",
- "userInput": {
- "brand": {
- "type": "string"
}, - "days": {
- "type": "int"
}
}, - "attributes": [
- {
- "key": "new_to_brand_attribute",
- "name": "New to {{brand}}",
- "matchRule": "meta[\"type\"] == \"orderPlace\" && exists(x:views[\"products\"], x[\"brand\"] == \"{{brand}}\")",
- "attrPaths": [
- "$.meta.timestampMillis"
], - "aggregation": {
- "type": "most-recent"
}, - "periodDays": "{{days}}"
}
], - "segment": {
- "name": "New to {{brand}}",
- "description": "Customers who are entering the brand for the first time or re-engaging after a long absence",
- "category": "New buyer",
- "rule": "not({{keys.new_to_brand_attribute}} after {{days}} days ago)"
}
}
}Lists up to the 10 most recent instantiations for the given template, ordered by application time (most recent first). Each entry includes the resulting segment and attributes (with their content-hash IDs and whether they were reused) and the user inputs provided.
| id required | string The template ID whose instantiations to list. |
[- {
- "id": 0,
- "templateId": "string",
- "timestamp": 0,
- "details": {
- "networkId": 0,
- "advertiserId": 0,
- "segmentRule": {
- "id": "string",
- "managementId": 0,
- "reused": true
}, - "attributes": [
- {
- "key": "string",
- "id": "string",
- "reused": true
}
], - "userInputs": {
- "property1": null,
- "property2": null
}
}
}
]Returns a paginated list of segment metadata.
| networkId required | integer <int32> The network ID associated with the segments. |
| region required | string The region associated with the segments. |
| pageSize | integer <int32> <= 50 Default: 20 Maximum number of segments to return per page. |
| page | integer <int32> Default: 1 The page number, starting at 1. |
{- "page": 1,
- "pageSize": 1,
- "segments": [
- {
- "id": "es_02f28ebe",
- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true,
- "networkId": 12345,
- "region": "eu-central-1"
}
]
}Creates a segment from metadata and attaches it to the network's "Kevel - Native Segments" destination. The destination is identified by the network ID and region supplied in the request body.
| networkId required | integer <int32> The network ID where the segment will be created. |
| region required | string The region for the network, for example |
| name required | string The segment name, which must be unique. |
| category | string The optional segment category. Defaults to an empty string when omitted. |
| description | string The optional segment description. Defaults to an empty string when omitted. |
| isStatic | boolean Whether to mark this segment as static. If a segment is static, its membership should be stable over time. Only static segments can be made available in Forecast. Defaults to false when omitted. |
{- "networkId": 12345,
- "region": "eu-central-1",
- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true
}{- "id": "es_02f28ebe",
- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true,
- "networkId": 12345,
- "region": "eu-central-1"
}Returns metadata for a segment.
| id required | string The segment ID. |
{- "id": "es_02f28ebe",
- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true,
- "networkId": 12345,
- "region": "eu-central-1"
}Updates segment metadata. Omitted fields retain their values.
| id required | string The segment ID. |
| name | string The new segment name, which must be unique. |
| category | string The new segment category. |
| description | string The new segment description. |
| isStatic | boolean Whether to mark this segment as static. |
{- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true
}{- "id": "es_02f28ebe",
- "name": "Core Customers",
- "category": "Loyalty",
- "description": "Top 20% revenue customers",
- "isStatic": true,
- "networkId": 12345,
- "region": "eu-central-1"
}Adds or removes a set of user memberships in segments. Unknown users are implicitly created for add operations, and removing a non-member is an idempotent no-op. The response reports an outcome for every membership operation and uses HTTP 200 even when individual edges fail.
The total number of membership edits, calculated as the number of entries in memberships, must not exceed 50.
| action required | string Enum: "add" "remove" The membership operation: either |
Array of objects (MembershipEntry) User in segment memberships to add or remove. The total membership edits count is capped at 50. |
{- "action": "add",
- "memberships": [
- {
- "userIdType": "email_sha256",
- "userId": "11d4c22e42c8f61feaba154683dea407b101cfd90987dda9e342843263ca420a",
- "segmentId": "es_0a873bfc"
}, - {
- "userIdType": "email_sha256",
- "userId": "11d4c22e42c8f61feaba154683dea407b101cfd90987dda9e342843263ca420a",
- "segmentId": "es_02f28ebe"
}, - {
- "userIdType": "email_sha256",
- "userId": "b0194b2e11548b547ddaff0e105b22347f94b625a7b964d7db72e1658c461a7f",
- "segmentId": "es_02f28ebe"
}
]
}{- "action": "add",
- "results": [
- {
- "userId": "11d4c22e42c8f61feaba154683dea407b101cfd90987dda9e342843263ca420a",
- "userIdType": "email_sha256",
- "segmentId": "es_02f28ebe"
}, - {
- "userId": "b0194b2e11548b547ddaff0e105b22347f94b625a7b964d7db72e1658c461a7f",
- "userIdType": "email_sha256",
- "segmentId": "es_0a873bfc",
- "error": "Segment with ID 'es_0a873bfc' not found."
}
]
}Returns whether a user is a member of the specified segment.
| id required | string The segment ID. |
| userIdType required | string The type of user ID. |
| userId required | string The user ID. |
{- "userId": "11d4c22e42c8f61feaba154683dea407b101cfd90987dda9e342843263ca420a",
- "userIdType": "email_sha256",
- "segmentId": "es_02f28ebe",
- "isMember": true
}Returns the segment IDs associated with a user.
| userIdType required | string The type of user ID. |
| userId required | string The user ID. |
| networkId required | integer <int32> The network ID associated with the segments. |
| region required | string The region associated with the segments. |
{- "userId": "11d4c22e42c8f61feaba154683dea407b101cfd90987dda9e342843263ca420a",
- "userIdType": "email_sha256",
- "segments": [
- "es_02f28ebe",
- "es_0a873bfc"
]
}