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 walks the store's public categories, products, and pages, writes the index file plus per-batch XML files, and records their paths on the sitemap.

TIP

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.
  • If sitemap generation is disabled in store configuration, the mutation still succeeds but writes no files (generatedSitemaps comes back empty).

Input fields

FieldTypeRequiredNotes
idIDYesThe sitemap's IRI

Response fields

FieldTypeNotes
sitemapIdIntNumeric id of the generated sitemap
indexFileStringPath of the written index file
generatedSitemapsArrayPaths of the per-batch product / category / page files
generatedAtStringTimestamp the generation finished
messageStringHuman-readable success message

Released under the MIT License.