Skip to content

Generate Sitemap

Builds the XML files for a sitemap — the Generate row action on the admin Marketing → Search & SEO → Sitemaps screen. Saving a sitemap does not build its files, so this is the explicit step that produces them.

New here? Read the Sitemaps overview for what a sitemap does and how its fields behave.

Endpoint

EndpointMethod
/api/admin/marketing/sitemaps/{id}/generatePOST

Details

  • Requires an admin Bearer token and the marketing.search_seo.sitemaps.edit permission.
  • Send an empty body — the sitemap id comes from the URL.
  • Runs once per channel the sitemap covers: for each, it walks that channel's root category subtree and the products and pages assigned to it, then writes an index file plus the per-batch XML files under sitemaps/{channel}/, using the channel's own hostname for the URLs inside them.
  • The response carries the generated file paths once the build finishes, grouped by channel.
  • A sitemap that covers no channel has nothing to generate and is refused with a 422 — assign at least one channel first.
  • If sitemap generation is disabled in the store configuration, the request still succeeds but produces no files (generatedFiles empty).

Response fields

FieldTypeNotes
sitemapIdintId of the sitemap that was generated
generatedFilesobject[]What the run wrote, one entry per channel: channelId, channelCode, hostname, index, sitemaps[]
urlsstring[]Public index URL per channel — the link to submit to a search engine
indexFilestringIndex path of a sitemap generated before generation became channel-aware. null for anything generated since
generatedSitemapsstring[]Child paths of a sitemap generated before generation became channel-aware. Empty for anything generated since
generatedAtstringTimestamp of this generate run
messagestringSuccess message

Released under the MIT License.