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.

TIP

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.
  • Walks every public category, product, and page, writes the index file plus the per-batch XML files, and records their paths and the generate timestamp on the sitemap row.
  • The response carries the generated file paths once the build finishes.
  • If sitemap generation is disabled in the store configuration, the request still succeeds but produces no files (indexFile null, generatedSitemaps empty).

Response fields

FieldTypeNotes
sitemapIdintId of the sitemap that was generated
indexFilestringPath of the generated index file
generatedSitemapsstring[]Paths of the per-batch XML files
generatedAtstringTimestamp of this generate run
messagestringSuccess message

Released under the MIT License.