API Documentation
Welcome to the official Sitemap.xml API documentation. Our RESTful API allows you to programmatically generate, manage, and push XML sitemaps to search engines at scale. Whether you're building a custom crawler, integrating with a headless CMS, or automating SEO workflows, this guide has you covered.
https://api.sitemap.xml/v3All endpoints return JSON responses. Timestamps follow ISO 8601 format. Pagination uses cursor-based navigation for datasets over 100 items.
Authentication
Access the API using API keys generated from your dashboard. All requests must include an Authorization header with the Bearer token scheme.
Authorization: Bearer sk_live_9f8e7d6c5b4a3210
Content-Type: application/json
Key Scopes
| Scope | Description |
|---|---|
sitemaps:read | Fetch existing sitemaps and metadata |
sitemaps:write | Generate, update, and delete sitemaps |
indexing:push | Submit URLs to search engine APIs |
analytics:read | Access coverage and performance metrics |
Quick Start
Get up and running in under 2 minutes. Install the SDK, configure your environment, and make your first API call.
npm install @sitemap/xml-sdk
# or
pip install sitemap-xml-py
# or
cargo add sitemap_xml_rs
import { SitemapClient } from '@sitemap/xml-sdk';
const client = new SitemapClient({
apiKey: process.env.SITEMAP_API_KEY,
baseUrl: 'https://api.sitemap.xml/v3'
});
const result = await client.sitemaps.generate({
url: 'https://example.com',
depth: 3,
include: ['css', 'js', 'images']
});
console.log(result.sitemapUrl);
POST /sitemaps/generate
Generate a dynamic sitemap from a live URL
Triggers a crawler that discovers all routes, handles JavaScript rendering, and outputs a valid XML sitemap compliant with W3C standards.
| Parameter | Type | Description |
|---|---|---|
url* | string | The root URL to crawl |
depth | integer | Max crawl depth (default: 3, max: 6) |
include | array | Asset types to include (css, js, images, fonts) |
userAgent | string | Custom crawler user agent string |
GET /sitemaps/{id}
Retrieve a generated sitemap by ID
Returns metadata, download URL, expiration timestamp, and raw XML content if requested via query parameter ?format=xml.
POST /indexing/push
Submit URLs directly to search engine APIs
Bypasses standard crawl delays by pushing URLs to Google Indexing API, Bing Webmaster Tools, and Yandex simultaneously.
| Parameter | Type | Description |
|---|---|---|
urls* | array[string] | List of URLs to submit (max 500 per request) |
providers | array | Target engines: google, bing, yandex (default: all) |
notify | boolean | Send webhook on completion |
GET /analytics/coverage
View indexing status and coverage metrics
Aggregate data on submitted URLs, indexing success rates, crawl errors, and estimated organic visibility score.
Error Handling
The API uses standard HTTP status codes. Errors return a JSON body with a structured error object.
| Code | Meaning |
|---|---|
400 | Bad Request - Invalid parameters or malformed JSON |
401 | Unauthorized - Missing or invalid API key |
403 | Forbidden - Insufficient scope or rate limit exceeded |
429 | Too Many Requests - Backoff using Retry-After header |
500 | Server Error - Internal failure (retry with exponential backoff) |
{
"error": {
"code": "rate_limit_exceeded",
"message": "You have exceeded 100 requests per minute.",
"docs": "https://docs.sitemap.xml/rate-limits"
}
}
Official SDKs
First-party libraries with TypeScript definitions, automatic retries, and webhook handling.
- JavaScript/TypeScript:
@sitemap/xml-sdk(npm) - Python:
sitemap-xml-py(PyPI) - Ruby:
sitemap_ruby(RubyGems) - Go:
github.com/sitemap-xml/go-sdk - PHP:
sitemap/xml-php(Packagist)
Rate Limits
Rate limits are enforced per API key to ensure platform stability. Limits vary by plan tier.
| Plan | Requests/min | Concurrent Crawls |
|---|---|---|
| Starter | 30 | 1 |
| Professional | 200 | 5 |
| Enterprise | Unlimited | 20+ |
Frequently Asked Questions
How long does sitemap generation take?
Typically 15-45 seconds for sites under 10k pages. Larger sites are processed asynchronously, and you'll receive a webhook notification when ready.
Can I schedule automatic updates?
Yes. Use the Cron Builder in your dashboard or integrate with GitHub Actions / Vercel Cron using the /sitemaps/generate endpoint.
Do you support headless / SPA frameworks?
Absolutely. Our crawler uses a headless Chrome engine that fully renders React, Next.js, Vue, Nuxt, SvelteKit, and Angular applications before extracting routes.