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
| Endpoint | Method |
|---|---|
/api/admin/marketing/sitemaps/{id}/generate | POST |
Details
- Requires an admin Bearer token and the
marketing.search_seo.sitemaps.editpermission. - 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 (
indexFilenull,generatedSitemapsempty).
Response fields
| Field | Type | Notes |
|---|---|---|
sitemapId | int | Id of the sitemap that was generated |
indexFile | string | Path of the generated index file |
generatedSitemaps | string[] | Paths of the per-batch XML files |
generatedAt | string | Timestamp of this generate run |
message | string | Success message |

