The sitemap endpoint returns the full sitemap analysis for a monitor, including detected sitemaps, URL counts, and any issues found. This is useful for verifying sitemap health on any monitor with the sitemap check enabled.
You'll need a monitor ID for this endpoint.
Example request:
$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/sitemap/1 \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
All endpoints below follow the same authentication pattern.
Get sitemap data #
GET /api/sitemap/{monitorId}
Returns the sitemap check results from the latest completed run. You can also fetch results from a specific past run by passing run_id (see check history).
Query parameters:
run_id (integer, optional) -- return results from a specific run instead of the latest. Get run IDs from the check history endpoint.
Here's what the response looks like:
{
"checkUrl": "https://example.com/sitemap.xml",
"totalIssuesCount": 1,
"totalUrlCount": 142,
"hasIssues": true,
"issues": [],
"sitemapIndexes": [
{
"url": "https://example.com/sitemap.xml",
"issues": []
}
],
"sitemaps": [
{
"url": "https://example.com/sitemap-pages.xml",
"urlCount": 42,
"checkedReachabilityOfAllUrls": true,
"issuesCount": 0,
"issues": []
},
{
"url": "https://example.com/sitemap-blog.xml",
"urlCount": 100,
"checkedReachabilityOfAllUrls": true,
"issuesCount": 1,
"issues": [
{
"name": "FailedUrlResponse",
"url": "https://example.com/blog/deleted-post",
"responseCode": 404
}
]
}
],
"run_id": 98765,
"run_started_at": "2026-03-17T00:30:00+00:00",
"run_ended_at": "2026-03-17T00:53:58+00:00"
}
Top-level fields #
checkUrl: the URL Oh Dear checked for sitemaps (typically https://yoursite.com/sitemap.xml)
totalIssuesCount: total number of issues found across all sitemaps and sitemap indexes
totalUrlCount: total number of URLs found across all sitemaps
hasIssues: whether any issues were detected (true/false)
issues: array of top-level issues (e.g., the check URL couldn't be loaded at all)
sitemapIndexes: array of detected sitemap indexes
sitemaps: array of detected sitemaps
run_id: the ID of the run these results come from
run_started_at: when the run started (ISO 8601, UTC), or null
run_ended_at: when the run completed (ISO 8601, UTC)
Sitemap fields #
Each entry in the sitemaps array contains:
url: the URL of the sitemap
urlCount: number of URLs listed in this sitemap
checkedReachabilityOfAllUrls: whether Oh Dear verified that every URL in the sitemap is reachable
issuesCount: number of issues found in this sitemap
issues: array of issue objects for this sitemap
Sitemap index fields #
Each entry in the sitemapIndexes array contains:
url: the URL of the sitemap index
issues: array of issue objects for this sitemap index
Issue fields #
Each issue contains:
name: the issue type identifier (see issue types below)
- Additional fields depending on the issue type (e.g.,
url, responseCode)
Issue types #
Oh Dear checks for these sitemap issues:
| Issue name |
Description |
CouldNotLoadCheckUrl |
The sitemap URL couldn't be loaded at all |
CouldNotLoadSitemapIndex |
A sitemap index file couldn't be loaded |
SitemapContainsInvalidXml |
The sitemap contains malformed XML |
SitemapIsEmpty |
The sitemap exists but contains no URLs |
SitemapContainsTooManyUrls |
The sitemap exceeds the maximum URL limit |
EmptyUrl |
A URL entry in the sitemap is empty |
InvalidUrl |
A URL in the sitemap is malformed |
NonUniqueUrl |
The same URL appears more than once |
InvalidChangeFrequency |
The value is not valid |
InvalidPriority |
The value is not valid |
FailedUrlResponse |
A URL in the sitemap returned an error response (includes responseCode) |
Error handling #
This endpoint returns 422 Unprocessable Entity when:
- The site does not have a sitemap check enabled
- The sitemap check hasn't run yet
- No sitemap was found for the site
Was this page helpful?
Feel free to reach out via support@ohdear.app
or on X via @OhDearApp if you have any other questions.
We'd love to help!