Segments
Segments allow you to partition your crawl data into meaningful subsets based on URL filters. For example, you might create segments for blog pages, product pages, or pages within a specific subdirectory.
What segments are
A segment is a named filter applied to crawl URLs within a project. Once created, Lumar generates segment-specific data after each crawl, allowing you to track metrics and health scores for that subset of pages independently.
Key properties of a segment:
name-- a descriptive label (e.g., "Blog Pages").group-- an optional grouping label for organising related segments.crawlUrlFilter-- a JSON filter object using the same predicate syntax asCrawlUrlConnectionFilterInput.
Creating a segment
Use the createCrawlUrlSegment mutation to define a new segment on a project.
- Mutation
- Variables
- Response
- cURL
mutation CreateCrawlUrlSegment($input: CreateCrawlUrlSegmentInput!) {
createCrawlUrlSegment(input: $input) {
segment {
id
name
group
crawlUrlFilter
createdAt
}
}
}
{
"input": {
"projectId": "TjAwN1Byb2plY3Q2MTMy",
"name": "Blog Pages",
"group": "Content",
"crawlUrlFilter": { "url": { "contains": "/blog/" } }
}
}
{
"data": {
"createCrawlUrlSegment": {
"segment": {
"id": "TjAyMVNlZ21lbnQx",
"name": "Blog Pages",
"group": "Content",
"crawlUrlFilter": { "url": { "contains": "/blog/" } },
"createdAt": "2025-01-15T10:00:00.000Z"
}
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"mutation CreateCrawlUrlSegment($input: CreateCrawlUrlSegmentInput!) { createCrawlUrlSegment(input: $input) { segment { id name group crawlUrlFilter createdAt } } }","variables":{"input":{"projectId":"TjAwN1Byb2plY3Q2MTMy","name":"Blog Pages","group":"Content","crawlUrlFilter":{"url":{"contains":"/blog/"}}}}}' https://api.lumar.io/graphql
The crawlUrlFilter uses the same filter syntax as the filter argument on crawl URL connections. See Filtering for the full predicate reference.
Querying segments
Retrieve all segments defined on a project:
- Query
- Response
- cURL
query GetProjectSegments($projectId: ObjectID!) {
getProject(id: $projectId) {
segments(first: 10) {
nodes {
id
name
group
crawlUrlFilter
createdAt
}
totalCount
}
}
}
{
"data": {
"getProject": {
"segments": {
"nodes": [
{
"id": "TjAyMVNlZ21lbnQx",
"name": "Blog Pages",
"group": "Content",
"crawlUrlFilter": { "url": { "contains": "/blog/" } },
"createdAt": "2025-01-10T08:00:00.000Z"
},
{
"id": "TjAyMVNlZ21lbnQy",
"name": "Product Pages",
"group": "Commerce",
"crawlUrlFilter": { "url": { "contains": "/products/" } },
"createdAt": "2025-01-10T08:30:00.000Z"
}
],
"totalCount": 2
}
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetProjectSegments($projectId: ObjectID!) { getProject(id: $projectId) { segments(first: 10) { nodes { id name group crawlUrlFilter createdAt } totalCount } } }"}' https://api.lumar.io/graphql
Segment health scores
Once a segment is created and a crawl completes, you can query health scores scoped to that segment. Pass the segmentId to the healthScore field on a crawl:
- Query
- Variables
- Response
- cURL
query GetSegmentHealthScore($crawlId: ObjectID!, $segmentId: ObjectID!) {
getCrawl(id: $crawlId) {
healthScore(reportCategoryCode: "seo", segmentId: $segmentId) {
healthScore
reportCategoryCode
segmentId
}
}
}
{
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ",
"segmentId": "TjAyMVNlZ21lbnQx"
}
{
"data": {
"getCrawl": {
"healthScore": [
{
"healthScore": 88.2,
"reportCategoryCode": "seo",
"segmentId": "TjAyMVNlZ21lbnQx"
}
]
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetSegmentHealthScore($crawlId: ObjectID!, $segmentId: ObjectID!) { getCrawl(id: $crawlId) { healthScore(reportCategoryCode: \"seo\", segmentId: $segmentId) { healthScore reportCategoryCode segmentId } } }","variables":{"crawlId":"TjAwNUNyYXdsMTU4MzI0NQ","segmentId":"TjAyMVNlZ21lbnQx"}}' https://api.lumar.io/graphql
You can also track segment health scores over time using getHealthScoreTrendForCrawlSegment, which works like getHealthScoreTrendForCrawl but accepts an additional segmentId parameter.
Use cases
| Use Case | Segment Filter Example |
|---|---|
| Blog content | { "url": { "contains": "/blog/" } } |
| Product pages | { "url": { "contains": "/products/" } } |
| Subdomain | { "url": { "beginsWith": "https://shop.example.com" } } |
| Non-indexable pages | { "indexable": { "eq": false } } |
| Large pages | { "pageSize": { "gt": 100000 } } |
Segments are especially useful when combined with health scores and dashboards to monitor specific areas of your site independently.