Languages

SitemapKit + Python

Use the SitemapKit API with Python's requests library to discover and extract sitemaps. Perfect for SEO scripts, data pipelines, and AI training data collection.

Written by SitemapKit Editorial TeamUpdated: Jul 21, 2026

Prerequisites

  • A SitemapKit API key kept outside browser and mobile client bundles.
  • A server-side Python environment that can make HTTPS requests and parse JSON responses.

How to connect SitemapKit and Python

  1. 1

    Store the API key for Python

    Use the secret or environment-variable mechanism provided by your languages setup. Never expose the key in client-side code.

  2. 2

    Call the SitemapKit full endpoint

    Adapt the request shown in the Python example below and send the target domain from a trusted server process.

  3. 3

    Map the response in Python

    Handle discovered sitemap files, extracted URLs, lastmod values, truncation flags, and API errors before passing the result downstream.

Quick start

import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://sitemapkit.com/api/v1/sitemap"

# Discover sitemaps
resp = requests.post(f"{BASE}/discover", json={"url": "example.com"}, headers={
    "x-api-key": API_KEY,
    "Content-Type": "application/json",
})
sitemaps = resp.json()["sitemaps"]
print(f"Found {len(sitemaps)} sitemaps")

# Extract all URLs
resp = requests.post(f"{BASE}/full", json={"url": "example.com"}, headers={
    "x-api-key": API_KEY,
    "Content-Type": "application/json",
})
data = resp.json()
print(f"Extracted {len(data['urls'])} URLs")

# Filter by pattern
blog_urls = [u["loc"] for u in data["urls"] if "/blog/" in u["loc"]]

Continue with SitemapKit

Start using SitemapKit with Python

100 free API calls/month. No credit card required.

More Languages integrations