Docs/API

Sitemap

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.

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
        }
      ]
    }
  ]
}

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

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 [email protected] or on X via @OhDearApp if you have any other questions. We'd love to help!