| [ Web Proxy ] |
| Viewing: https://docs.lytics.com/docs/segment-api | [Back] [Original] |
Programmatically manage audiences using the Segment API.
The Segment API allows you to programmatically create, update, delete, and query audiences. While most audience management can be done through the Lytics UI, the API is useful for automating audience workflows, integrating with external systems, or building custom tooling.
GET /v2/segment
Returns all segments for the account.
GET /v2/segment/{id}
Returns details of a specific segment, including its SegmentQL definition, membership size, and metadata.
POST /v2/segment
Creates a new segment.
{
"name": "High Value Customers",
"slug_name": "high_value_customers",
"is_public": true,
"table": "user",
"ast": {
"// SegmentQL AST definition"
}
}PUT /v2/segment/{id}
Updates an existing segment's definition, name, or other properties.
DELETE /v2/segment/{id}
Deletes a segment. This does not delete the underlying user profiles.
POST /v2/segment/{id}/reevaluate
Triggers a full reevaluation of segment membership. Normally, segment membership is updated in real-time as profile data changes. Use reevaluation when:
Reevaluation runs asynchronously. For large segments, it may not complete immediately.
GET /v2/segment/{id}/ancestors
Returns the lineage of a segment -- the parent segments that this segment depends on or is derived from. This is useful for understanding segment composition when segments reference other segments in their definitions.
GET /v2/segment/{id}/jobs
Returns the workflow jobs associated with a segment, including active exports and imports.
Segment groups allow you to organize audiences into logical folders.
GET /v2/segment/group
POST /v2/segment/group
{
"name": "Campaign Audiences",
"description": "Audiences used for Q1 campaigns"
}PUT /v2/segment/group/{id}
DELETE /v2/segment/group/{id}
Deleting a group does not delete the segments within it.
Updated 6 months ago
| Web Proxy Viewer | New URL | Original Page |