# Sitemap Generator API

> Sitemap Generator is a website sitemap generator API that creates valid XML sitemaps from URL lists following the sitemaps.org protocol for search engine optimization.

**Endpoint:** `POST https://api.apiverve.com/v1/sitemapgenerator`  
**Category:** Data Generation  
**Cost:** 2 credits per call  
**Canonical page:** https://apiverve.com/marketplace/sitemapgenerator

## Overview

Generates properly formatted XML compliant with search engine requirements, supporting up to 50,000 URLs per sitemap.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/sitemapgenerator" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls":["/","/about","/contact",{"url":"/blog","priority":0.8,"changeFreq":"daily"},{"url":"/products","priority":0.9}],"baseUrl":"https://example.com","changeFreq":"weekly","priority":0.5,"includeLastMod":true}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `urls` | array | Yes | Array of URLs (strings or objects with url, priority, changeFreq, lastMod). Non-ASCII paths are percent-encoded and international domains punycoded; exact duplicates are dropped |
| `baseUrl` | string | No | Base URL to prepend to relative paths. url |
| `changeFreq` | string | No | Default change frequency. default weekly. One of: always, hourly, daily, weekly, monthly, yearly, never |
| `priority` | number | No | Default priority. default 0.5. range 0-1 |
| `includeLastMod` | boolean | No | Include lastmod dates in sitemap. URLs without their own lastMod are stamped with the request date, so pass false when you have no real modification dates. default true |

## Response fields

- `sitemap` — string · Generated XML sitemap content following sitemaps.org protocol
- `urlCount` — number · Total number of URLs included in the generated sitemap
- `sizeBytes` — number · Total size of generated sitemap in bytes · (premium)
- `sizeKb` — number · Total size of generated sitemap in kilobytes · (premium)
- `format` — string · Output format type of generated sitemap content
- `protocol` — string · Sitemap protocol version used for XML generation
- `settings` — object
  - `settings.defaultChangeFreq` — string · Default change frequency setting applied to all URLs
  - `settings.defaultPriority` — number · Default priority value assigned to all URLs
  - `settings.includeLastMod` — boolean · Flag indicating if last modified dates are included
  - `settings.baseUrl` — string · Base URL used to create absolute paths for relative URLs

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "sitemap": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://example.com/</loc>\n    <lastmod>2025-12-16</lastmod>\n    <changefreq>weekly</changefreq>\n    <priority>0.5</priority>\n  </url>\n  <url>\n    <loc>https://example.com/about</loc>\n    <lastmod>2025-12-16</lastmod>\n    <changefreq>weekly</changefreq>\n    <priority>0.5</priority>\n  </url>\n  <url>\n    <loc>https://example.com/contact</loc>\n    <lastmod>2025-12-16</lastmod>\n    <changefreq>weekly</changefreq>\n    <priority>0.5</priority>\n  </url>\n  <url>\n    <loc>https://example.com/blog</loc>\n    <lastmod>2025-12-16</lastmod>\n    <changefreq>daily</changefreq>\n    <priority>0.8</priority>\n  </url>\n  <url>\n    <loc>https://example.com/products</loc>\n    <lastmod>2025-12-16</lastmod>\n    <changefreq>weekly</changefreq>\n    <priority>0.9</priority>\n  </url>\n</urlset>",
    "urlCount": 5,
    "sizeBytes": 892,
    "sizeKb": 0.87,
    "format": "XML",
    "protocol": "sitemaps.org/0.9",
    "settings": {
      "defaultChangeFreq": "weekly",
      "defaultPriority": 0.5,
      "includeLastMod": true,
      "baseUrl": "https://example.com"
    }
  }
}
```

## Use cases

- **SEO Optimization** — Generate sitemaps to help search engines index website content
- **Website Management** — Create and maintain XML sitemaps for content management systems
- **Build Automation** — Integrate sitemap generation into website deployment pipelines
- **Multi-site Management** — Generate sitemaps for multiple websites with custom configurations

## SDKs

- **npm** — `npm install @apiverve/sitemapgenerator` (https://www.npmjs.com/package/@apiverve/sitemapgenerator)
- **PyPI** — `pip install apiverve-sitemapgenerator` (https://pypi.org/project/apiverve-sitemapgenerator/)
- **NuGet** — `dotnet add package APIVerve.API.SitemapGenerator` (https://www.nuget.org/packages/APIVerve.API.SitemapGenerator)
- **Source** — https://github.com/apiverve/sitemapgenerator-api

## More

- Full reference: https://docs.apiverve.com/ref/sitemapgenerator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
