Use SitemapKit with full TypeScript type safety. Define response types for sitemap data and integrate into your typed codebases.
type SitemapUrl = {
loc: string;
lastmod?: string;
changefreq?: string;
priority?: number;
};
type FullResponse = {
sitemaps: string[];
urls: SitemapUrl[];
metadata: { totalUrls: number; cached: boolean };
};
async function getSitemapData(domain: string): Promise<FullResponse> {
const res = await fetch("https://sitemapkit.com/api/v1/sitemap/full", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.SITEMAPKIT_API_KEY!,
},
body: JSON.stringify({ url: domain }),
});
if (!res.ok) throw new Error(`API error: ${res.status}`);
return res.json() as Promise<FullResponse>;
}
const data = await getSitemapData("example.com");
console.log(`${data.urls.length} URLs extracted`);sk_live_* API key./api/v1/sitemap/full endpoint to discover and extract all sitemaps from a domain in one call.POST /api/v1/sitemap/discover — Find all sitemaps on a domainPOST /api/v1/sitemap/extract — Parse a sitemap URL and extract all URLsPOST /api/v1/sitemap/full — Discover + extract in one call (recommended)100 free API calls/month. No credit card required.