Skip to content

Generate Sitemap ​

Builds the actual XML files for a sitemap — the Generate action on the admin Marketing → Search & SEO → Sitemaps screen. It 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, writes an index file plus per-batch XML files under sitemaps/{channel}/, and records what it wrote.

A sitemap that covers no channel has nothing to generate and is refused — assign at least one channel first.

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

Operation ​

OperationTypePurpose
createAdminMarketingSitemapGenerateMutationBuild the XML files for a sitemap

Details ​

  • Requires an admin Bearer token and the marketing.search_seo.sitemaps.edit permission.
  • Pass the sitemap's IRI (e.g. /api/admin/marketing/sitemaps/1) as id. Use the list query to discover valid ids.
  • Generation runs synchronously — the response carries the written paths once it finishes.
  • Creating or updating a sitemap does not auto-generate. Call this mutation explicitly to (re)build the files.
  • A sitemap that covers no channel is refused — there is nothing to walk.
  • If sitemap generation is disabled in store configuration, the mutation still succeeds but writes no files (generatedFiles comes back empty).

Input fields ​

FieldTypeRequiredNotes
idIDYesThe sitemap's IRI

Response fields ​

FieldTypeNotes
sitemapIdIntNumeric id of the generated sitemap
generatedFilesArrayWhat the run wrote, one entry per channel: channelId, channelCode, hostname, index, sitemaps[]
urlsArrayPublic 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
generatedSitemapsArrayChild paths of a sitemap generated before generation became channel-aware. Empty for anything generated since
generatedAtStringTimestamp the generation finished
messageStringHuman-readable success message

Released under the MIT License.