Upload Endpoint
Full documentation for the POST /api/sitemap/generate endpoint including URL properties, splitting options, and named sitemaps
The upload endpoint generates XML sitemaps from a list of URLs. It handles validation, automatic splitting, XML generation, storage, and optional search engine notification.
Endpoint
POST https://dash.sitemaphost.app/api/sitemap/generate
Request Headers
| Header | Required | Value |
|---|---|---|
Content-Type | Yes | application/json |
X-API-Key | Yes | Your API key (sk_live_...) |
Request Body
{
"domain": "sitemap.yoursite.com",
"sitemapName": "pages",
"sizeLimit": "gsc-optimized",
"urls": [
{
"loc": "https://yoursite.com/",
"lastmod": "2024-01-15",
"changefreq": "daily",
"priority": 1.0
}
],
"pingGoogle": true
}Top-Level Properties
| Property | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | Your registered domain (e.g., sitemap.yoursite.com) |
urls | array | Yes | Array of URL objects (see below) |
sitemapName | string | No | Name for the sitemap (e.g., "pages", "products", "blog"). Creates a named sitemap file like sitemap-pages.xml |
sizeLimit | string | No | Splitting strategy. Default: "standard" |
pingGoogle | boolean | No | (Deprecated) Legacy Google ping. No longer functional — use GSC integration instead. Default: false |
sizeLimit Options
Controls how large sitemaps are split into chunks:
| Value | URLs per File | Best For |
|---|---|---|
"gsc-optimized" | 1,000 | Google Search Console monitoring -- smaller files mean faster GSC processing and clearer indexing insights |
"balanced" | 10,000 | Sites with 10k-100k URLs that want a reasonable number of files |
"standard" | 50,000 | Maximum URLs per file allowed by the sitemap protocol |
When your URL count exceeds the chunk size, SitemapHost automatically creates multiple sitemap files and a sitemap index that references them all.
Example: 25,000 URLs with "gsc-optimized" creates 25 sitemap files plus a sitemap index.
URL Object Properties
Each object in the urls array describes a single page on your website.
Core Properties
| Property | Type | Required | Description |
|---|---|---|---|
loc | string | Yes | Full URL of the page (must include https://) |
lastmod | string | No | Last modification date in ISO 8601 format (YYYY-MM-DD or full datetime) |
changefreq | string | No | How often the page changes: always, hourly, daily, weekly, monthly, yearly, never |
priority | number | No | Priority relative to other URLs on your site, from 0.0 to 1.0. Default: 0.5 |
{
"loc": "https://yoursite.com/blog/my-post",
"lastmod": "2024-01-15T10:30:00Z",
"changefreq": "weekly",
"priority": 0.7
}Note: Google has stated it ignores
changefreqandpriority. However, other search engines may still use these fields. Thelastmodfield is the most important metadata afterloc.
Image Properties
Add an images array to include image metadata for Google Images. Each URL can have up to 1,000 images.
| Property | Type | Required | Description |
|---|---|---|---|
images[].loc | string | Yes | URL of the image file |
images[].title | string | No | Title/alt text for the image |
images[].caption | string | No | Longer description of the image |
images[].geo_location | string | No | Geographic location (e.g., "New York, USA") |
images[].license | string | No | URL to the image's license page |
{
"loc": "https://yoursite.com/products/blue-widget",
"lastmod": "2024-01-15",
"images": [
{
"loc": "https://cdn.yoursite.com/images/blue-widget-front.jpg",
"title": "Blue Widget - Front View",
"caption": "Premium blue widget with chrome accents"
},
{
"loc": "https://cdn.yoursite.com/images/blue-widget-side.jpg",
"title": "Blue Widget - Side View"
}
]
}See Image Sitemaps for detailed guidance.
Hreflang Properties
Add an hreflang array for international SEO. Each entry specifies an alternate language version of the page.
| Property | Type | Required | Description |
|---|---|---|---|
hreflang[].href | string | Yes | URL of the alternate language version |
hreflang[].hreflang | string | Yes | Language code in ISO 639-1 format (e.g., "en", "es", "fr") or language-region (e.g., "en-US", "pt-BR") |
{
"loc": "https://yoursite.com/about",
"lastmod": "2024-01-15",
"hreflang": [
{ "href": "https://yoursite.com/about", "hreflang": "en" },
{ "href": "https://yoursite.com/es/about", "hreflang": "es" },
{ "href": "https://yoursite.com/fr/about", "hreflang": "fr" },
{ "href": "https://yoursite.com/about", "hreflang": "x-default" }
]
}The x-default value designates the fallback URL for users whose language does not match any listed alternative.
Generated XML output:
<url>
<loc>https://yoursite.com/about</loc>
<lastmod>2024-01-15</lastmod>
<xhtml:link rel="alternate" hreflang="en" href="https://yoursite.com/about"/>
<xhtml:link rel="alternate" hreflang="es" href="https://yoursite.com/es/about"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://yoursite.com/fr/about"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://yoursite.com/about"/>
</url>News Properties
Add a news object for Google News sitemaps. Only include pages published within the last 48 hours.
| Property | Type | Required | Description |
|---|---|---|---|
news.publication.name | string | Yes | Name of the publication |
news.publication.language | string | Yes | Language code (e.g., "en") |
news.publication_date | string | Yes | Publication date in ISO 8601 format |
news.title | string | Yes | Article title |
news.keywords | string | No | Comma-separated keywords |
news.stock_tickers | string | No | Stock tickers (e.g., "NASDAQ:GOOG") |
{
"loc": "https://yoursite.com/news/breaking-story",
"news": {
"publication": {
"name": "Your News Site",
"language": "en"
},
"publication_date": "2024-01-15T10:30:00Z",
"title": "Breaking: Major Event Happens",
"keywords": "breaking news, major event"
}
}See News Sitemaps for detailed guidance.
Video Properties
Add a video object for Google Video sitemaps.
| Property | Type | Required | Description |
|---|---|---|---|
video.thumbnail_loc | string | Yes | URL to the video thumbnail |
video.title | string | Yes | Video title (max 100 chars) |
video.description | string | Yes | Video description (max 2,048 chars) |
video.content_loc | string | * | Direct URL to the video file |
video.player_loc | string | * | URL to the embeddable player |
video.duration | number | No | Duration in seconds |
video.view_count | number | No | Number of views |
video.rating | number | No | Rating from 0.0 to 5.0 |
video.publication_date | string | No | ISO 8601 publish date |
video.expiration_date | string | No | ISO 8601 expiration date |
video.family_friendly | boolean | No | Safe for all ages (default: true) |
video.live | boolean | No | Whether this is a live stream |
video.tag | string[] | No | Tags (max 32) |
video.category | string | No | Video category |
video.uploader | object | No | { name, info } uploader details |
* Either content_loc or player_loc is required.
{
"loc": "https://yoursite.com/videos/tutorial",
"video": {
"thumbnail_loc": "https://cdn.yoursite.com/thumbs/tutorial.jpg",
"title": "Product Tutorial",
"description": "Learn how to use our product in 10 minutes.",
"content_loc": "https://cdn.yoursite.com/videos/tutorial.mp4",
"duration": 600,
"view_count": 12000,
"publication_date": "2024-01-10T08:00:00Z",
"tag": ["tutorial", "product", "getting started"]
}
}See Video Sitemaps for detailed guidance.
Full Example Request
A complete request with multiple URL types:
curl -X POST https://dash.sitemaphost.app/api/sitemap/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-d '{
"domain": "sitemap.yoursite.com",
"sitemapName": "pages",
"sizeLimit": "gsc-optimized",
"pingGoogle": true,
"urls": [
{
"loc": "https://yoursite.com/",
"lastmod": "2024-01-15",
"priority": 1.0,
"changefreq": "daily"
},
{
"loc": "https://yoursite.com/products/widget",
"lastmod": "2024-01-14",
"images": [
{
"loc": "https://cdn.yoursite.com/widget.jpg",
"title": "Widget Photo"
}
]
},
{
"loc": "https://yoursite.com/about",
"lastmod": "2024-01-10",
"hreflang": [
{ "href": "https://yoursite.com/about", "hreflang": "en" },
{ "href": "https://yoursite.com/es/about", "hreflang": "es" }
]
}
]
}'Success Response
{
"success": true,
"data": {
"domain": "sitemap.yoursite.com",
"sitemapName": "pages",
"urlCount": 3,
"filesGenerated": 1,
"sitemapUrl": "https://sitemap.yoursite.com/sitemap-pages.xml",
"indexUrl": "https://sitemap.yoursite.com/sitemap-index.xml",
"googlePing": {
"status": "success",
"pingedAt": "2024-01-15T10:30:05Z"
},
"indexNow": {
"status": "success",
"urlsSubmitted": 3
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
domain | string | The domain the sitemap was generated for |
sitemapName | string | Name of the named sitemap (if provided) |
urlCount | number | Total URLs in the sitemap |
filesGenerated | number | Number of sitemap XML files created |
sitemapUrl | string | URL of the generated sitemap file |
indexUrl | string | URL of the sitemap index (present when multiple files are generated or when using named sitemaps) |
googlePing | object | Google ping result (deprecated — Google's ping endpoint no longer functions; use GSC integration instead) |
indexNow | object | IndexNow submission result (if enabled for the domain) |
Error Responses
Validation error (422)
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid URL: 'not-a-url' is not a valid absolute URL.",
"details": {
"field": "urls[0].loc",
"value": "not-a-url"
}
}
}Domain not found (404)
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Domain 'sitemap.example.com' not found. Add it in your dashboard first."
}
}URL budget exceeded (422)
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "URL count (75000) exceeds your plan limit of 50000. Upgrade your plan or reduce the number of URLs."
}
}URL Validation Rules
SitemapHost validates every URL before generating the sitemap:
locmust be an absolute URL starting withhttps://orhttp://locmust not exceed 2,048 characterslastmodmust be a valid ISO 8601 date (YYYY-MM-DDorYYYY-MM-DDTHH:mm:ssZ)prioritymust be between0.0and1.0changefreqmust be one of:always,hourly,daily,weekly,monthly,yearly,never- Image
locvalues must be valid absolute URLs - Hreflang codes must be valid ISO 639-1 language codes or
x-default - Total URL count must not exceed your plan's URL budget
Next Steps
- Domains Endpoint -- Domain management API
- Multi-Sitemap Support -- Organize URLs with named sitemaps
- Automatic Splitting -- How splitting works in detail