Health Scores
Health scores provide a single numeric summary (0--100) of your site's performance within a report category such as SEO, Accessibility, or Site Speed. They are calculated after every crawl based on the pass/fail results of individual health score tests.
Querying a single health score
Use the getHealthScore query when you need the score for a specific report category and crawl. You can optionally scope the result to a segment.
- Query
- Variables
- Response
- cURL
query GetHealthScore($input: GetHealthScoreInput!) {
getHealthScore(input: $input) {
crawlId
healthScore
categoryWeight
createdAt
healthScoreTestResults(first: 10) {
nodes {
reportCategoryCode
passed
severity
}
}
}
}
{
"input": {
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ",
"reportCategoryCode": "seo"
}
}
{
"data": {
"getHealthScore": {
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ",
"healthScore": 85.4,
"categoryWeight": 1.0,
"createdAt": "2025-01-15T10:30:00.000Z",
"healthScoreTestResults": {
"nodes": [
{
"reportCategoryCode": "seo",
"passed": true,
}
]
}
}
}
}
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 GetHealthScore($input: GetHealthScoreInput!) { getHealthScore(input: $input) { crawlId healthScore categoryWeight createdAt healthScoreTestResults(first: 10) { nodes { reportCategoryCode passed severity } } } }","variables":{"input":{"crawlId":"TjAwNUNyYXdsMTU4MzI0NQ","reportCategoryCode":"seo"}}}' https://api.lumar.io/graphql
Querying multiple health scores for a crawl
To retrieve scores for several categories at once, use the healthScores field on a Crawl object.
- Query
- Variables
- Response
- cURL
query GetCrawlHealthScores($crawlId: ObjectID!) {
getCrawl(id: $crawlId) {
healthScores(reportCategoryCodes: ["seo", "accessibility", "site_speed"]) {
healthScore
reportCategoryCode
categoryWeight
}
}
}
{
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ"
}
{
"data": {
"getCrawl": {
"healthScores": [
{
"healthScore": 85.4,
"reportCategoryCode": "seo",
"categoryWeight": 1.0
},
{
"healthScore": 92.1,
"reportCategoryCode": "accessibility",
"categoryWeight": 1.0
},
{
"healthScore": 78.3,
"reportCategoryCode": "site_speed",
"categoryWeight": 1.0
}
]
}
}
}
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 GetCrawlHealthScores($crawlId: ObjectID!) { getCrawl(id: $crawlId) { healthScores(reportCategoryCodes: [\"seo\", \"accessibility\", \"site_speed\"]) { healthScore reportCategoryCode categoryWeight } } }","variables":{"crawlId":"TjAwNUNyYXdsMTU4MzI0NQ"}}' https://api.lumar.io/graphql
Health score trends
The getHealthScoreTrendForCrawl query returns historical health scores across multiple crawls, allowing you to chart improvements or regressions over time.
- Query
- Variables
- Response
- cURL
query GetHealthScoreTrend($crawlId: ObjectID!) {
getHealthScoreTrendForCrawl(crawlId: $crawlId, first: 10) {
nodes {
crawlId
healthScores {
healthScore
reportCategoryCode
}
}
totalCount
}
}
{
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ"
}
{
"data": {
"getHealthScoreTrendForCrawl": {
"nodes": [
{
"crawlId": "TjAwNUNyYXdsMTU4MzI0Mw",
"healthScores": [
{
"healthScore": 82.1,
"reportCategoryCode": "seo"
}
]
},
{
"crawlId": "TjAwNUNyYXdsMTU4MzI0NQ",
"healthScores": [
{
"healthScore": 85.4,
"reportCategoryCode": "seo"
}
]
}
],
"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 GetHealthScoreTrend($crawlId: ObjectID!) { getHealthScoreTrendForCrawl(crawlId: $crawlId, first: 10) { nodes { crawlId healthScores { healthScore reportCategoryCode } } totalCount } }","variables":{"crawlId":"TjAwNUNyYXdsMTU4MzI0NQ"}}' https://api.lumar.io/graphql
Creating health score tests
Health score tests define the thresholds that determine whether a report category passes or fails. Use the createHealthScoreTest mutation to add a new test to a test suite.
- Mutation
- Variables
- Response
- cURL
mutation CreateHealthScoreTest($input: CreateHealthScoreTestInput!) {
createHealthScoreTest(input: $input) {
healthScoreTest {
absoluteThreshold
automaticThresholdEnabled
reportCategoryCode
severity
thresholdPredicate
thresholdType
}
}
}
{
"input": {
"testSuiteId": "TjAxMVRlc3RTdWl0ZTEyMw",
"reportCategoryCode": "seo",
"absoluteThreshold": 0.8,
"thresholdType": "Relative",
"relativeThreshold": 10,
"severity": "Fail",
"automaticThresholdEnabled": false
}
}
{
"data": {
"createHealthScoreTest": {
"healthScoreTest": {
"absoluteThreshold": 0.8,
"automaticThresholdEnabled": false,
"reportCategoryCode": "seo",
"severity": "Fail",
"thresholdPredicate": "GreaterThanOrEqual",
"thresholdType": "Relative"
}
}
}
}
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 CreateHealthScoreTest($input: CreateHealthScoreTestInput!) { createHealthScoreTest(input: $input) { healthScoreTest { absoluteThreshold automaticThresholdEnabled reportCategoryCode severity thresholdPredicate thresholdType } } }","variables":{"input":{"testSuiteId":"TjAxMVRlc3RTdWl0ZTEyMw","reportCategoryCode":"seo","absoluteThreshold":0.8,"thresholdType":"Relative","relativeThreshold":10,"severity":"Fail","automaticThresholdEnabled":false}}}' https://api.lumar.io/graphql
Key fields in CreateHealthScoreTestInput:
| Field | Description |
|---|---|
reportCategoryCode | The report category this test targets (e.g., "seo"). |
absoluteThreshold | The absolute number threshold for pass/fail. |
relativeThreshold | Percentage change threshold (used when thresholdType is Relative). |
thresholdType | Either Relative or Absolute. |
severity | Fail or Warning -- controls how a breach is reported. |
automaticThresholdEnabled | When true, Lumar adjusts thresholds automatically based on historical results. |
Automatic thresholds
When automaticThresholdEnabled is set to true, Lumar will adjust the test threshold based on previous crawl results. You can control the acceptance behaviour for improving and worsening results independently using:
automaticThresholdAcceptanceWhenTestResultIsBetter-- whether to automatically accept the new threshold when scores improve.automaticThresholdAcceptanceWhenTestResultIsWorse-- whether to automatically accept the new threshold when scores regress.
Copying tests between projects
Use copyHealthScoreTests to duplicate health score tests from one project to another. Existing tests with the same reportCategoryCode in the target project will be overwritten.
- Mutation
- Variables
- Response
- cURL
mutation CopyHealthScoreTests($input: CopyHealthScoreTestsInput!) {
copyHealthScoreTests(input: $input) {
healthScoreTests {
reportCategoryCode
absoluteThreshold
severity
}
}
}
{
"input": {
"fromProjectId": "TjAwN1Byb2plY3Q2MTMy",
"toProjectId": "TjAwN1Byb2plY3Q5OTA2",
"reportCategoryCodes": ["seo", "accessibility"]
}
}
{
"data": {
"copyHealthScoreTests": {
"healthScoreTests": [
{
"reportCategoryCode": "seo",
"absoluteThreshold": 0.8,
"severity": "Fail"
},
{
"reportCategoryCode": "accessibility",
"absoluteThreshold": 0.9,
"severity": "Warning"
}
]
}
}
}
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 CopyHealthScoreTests($input: CopyHealthScoreTestsInput!) { copyHealthScoreTests(input: $input) { healthScoreTests { reportCategoryCode absoluteThreshold severity } } }","variables":{"input":{"fromProjectId":"TjAwN1Byb2plY3Q2MTMy","toProjectId":"TjAwN1Byb2plY3Q5OTA2","reportCategoryCodes":["seo","accessibility"]}}}' https://api.lumar.io/graphql