Get Segments
Retrieve a list of segments (saved audience groups) or cohorts (time-based user groups) for a specific website.
Endpoint
GET /api/websites/{websiteId}/segments
Bearer token for authentication
Path Parameters
Query Parameters
Segment type: segment or cohort
Search term to filter segments by name
Response
Array of segment objects
Website UUID this segment belongs to
Segment type: segment or cohort
Segment name (max 200 characters)
Segment configuration parameters (structure varies by segment type)
ISO 8601 timestamp of creation
ISO 8601 timestamp of last update
Example Request
curl "https://your-umami-instance.com/api/websites/550e8400-e29b-41d4-a716-446655440000/segments?type=segment" \
-H "Authorization: Bearer YOUR_TOKEN"
Example Response
[
{
"id": "770e8400-e29b-41d4-a716-446655440001",
"websiteId": "550e8400-e29b-41d4-a716-446655440000",
"type": "segment",
"name": "Mobile Users",
"parameters": {
"filters": {
"device": "mobile"
}
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
},
{
"id": "880e8400-e29b-41d4-a716-446655440002",
"websiteId": "550e8400-e29b-41d4-a716-446655440000",
"type": "segment",
"name": "US Visitors",
"parameters": {
"filters": {
"country": "US"
}
},
"createdAt": "2024-02-20T14:45:00.000Z",
"updatedAt": "2024-02-20T14:45:00.000Z"
}
]
Segments allow you to save filter combinations for quick access. Cohorts are time-based groups that track user behavior over time.