Skip to main content

Get Segment

Retrieve detailed information about a specific segment or cohort.

Endpoint

GET /api/websites/{websiteId}/segments/{segmentId}

Headers

Authorization
string
required
Bearer token for authentication

Path Parameters

websiteId
string
required
Website UUID
segmentId
string
required
Segment UUID

Response

id
string
Segment UUID
websiteId
string
Website UUID
type
string
Segment type: segment or cohort
name
string
Segment name
parameters
object
Segment configuration parameters
createdAt
string
ISO 8601 timestamp of creation
updatedAt
string
ISO 8601 timestamp of last update

Example Request

curl "https://your-umami-instance.com/api/websites/550e8400-e29b-41d4-a716-446655440000/segments/770e8400-e29b-41d4-a716-446655440001" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "id": "770e8400-e29b-41d4-a716-446655440001",
  "websiteId": "550e8400-e29b-41d4-a716-446655440000",
  "type": "segment",
  "name": "Mobile Users from US",
  "parameters": {
    "filters": {
      "device": "mobile",
      "country": "US"
    }
  },
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-02-20T14:15:00.000Z"
}

Error Responses

401
error
Unauthorized - You don’t have permission to view this segment
404
error
Not Found - Segment does not exist
You must have view permissions for the website to access its segments.

Build docs developers (and LLMs) love