API Reference

Welcome to the Sitemap.xml API documentation. Our RESTful API allows you to programmatically generate, manage, and submit sitemaps to search engines. All requests must be made over HTTPS. Calls made over plain HTTP will fail.

Base URL: https://api.sitemap.xml/v1
💡
Need help integrating? Check out our SDKs & Code Examples for JavaScript, Python, and PHP.

Authentication

Authenticate your API requests by including your secret key in the request header. Keep your API keys secure and never expose them in client-side code.

cURL
curl -X GET https://api.sitemap.xml/v1/sitemaps \n -H "Authorization": "Bearer sk_live_your_api_key_here"
Header Type Description
Authorization string Bearer token containing your API key
X-Request-ID string Optional unique identifier for request tracing

POST Generate Sitemap

Initiates a new sitemap generation job for a specified domain. The API will crawl the site, extract URLs, and build a compliant XML sitemap.

cURL
curl -X POST https://api.sitemap.xml/v1/sitemaps \n -H "Authorization": "Bearer sk_live_xxxx" \n -H "Content-Type": "application/json" \n -d '{\n "domain": "https://example.com",\n "max_depth": 3,\n "exclude_patterns": ["/admin/*", "/private/*"]\n}'

Request Parameters

ParameterTypeRequiredDescription
domainstringRequiredRoot domain to crawl
max_depthintegerOptionalMax crawl depth (default: 5)
exclude_patternsarrayOptionalGlob patterns to skip
include_assetsbooleanOptionalInclude images/videos (default: true)

Response

JSON 202 Accepted
{ "id": "sitemap_9f8a7b6c", "status": "processing", "domain": "https://example.com", "created_at": "2025-01-15T10:30:00Z", "estimated_urls": 124, "webhook_url": null }

GET Get Sitemap

Retrieve the generated sitemap content, status, and metadata by ID.

cURL
curl -X GET https://api.sitemap.xml/v1/sitemaps/{id} \n -H "Authorization": "Bearer sk_live_xxxx"

Response

JSON 200 OK
{ "id": "sitemap_9f8a7b6c", "status": "completed", "xml_url": "https://cdn.sitemap.xml/v1/sitemap_9f8a7b6c.xml", "html_url": "https://cdn.sitemap.xml/v1/sitemap_9f8a7b6c.html", "urls_count": 124, "completed_at": "2025-01-15T10:34:22Z" }

POST Submit for Indexing

Push URLs directly to Google, Bing, and Yandex indexing queues using our high-throughput pipeline.

cURL
curl -X POST https://api.sitemap.xml/v1/indexing/submit \n -H "Authorization": "Bearer sk_live_xxxx" \n -d '{\n "sitemap_id": "sitemap_9f8a7b6c",\n "engines": ["google", "bing", "yandex"],\n "force_refresh": false\n}'

Response Codes

202
Accepted & queued for submission
400
Invalid sitemap ID or malformed request
401
Invalid or missing API key
429
Rate limit exceeded

Rate Limits

API requests are rate-limited based on your subscription tier. Limits are applied per API key and reset every 60 seconds.

PlanRequests/MinConcurrent Crawls
Starter301
Professional3005
Enterprise3,000Unlimited

When you exceed your rate limit, the API returns a 429 Too Many Requests response. Implement exponential backoff in your client to handle retries gracefully.

Error Handling

Sitemap.xml uses standard HTTP status codes to indicate success or failure. Codes in the 2xx range indicate success, 4xx indicate client errors, and 5xx indicate server errors.

JSON Error Response
{ "error": { "code": "invalid_domain", "message": "The provided domain is unreachable or blocked by robots.txt", "request_id": "req_a8f9c2e1" } }