AI Frameworks

SitemapKit + LangChain

Use SitemapKit as a tool in LangChain agents or as a URL source for document loaders. Get all URLs from a domain to build RAG pipelines.

Written by SitemapKit Editorial TeamUpdated: Jul 21, 2026

Prerequisites

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

How to connect SitemapKit and LangChain

  1. 1

    Store the API key for LangChain

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

  2. 2

    Call the SitemapKit full endpoint

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

  3. 3

    Map the response in LangChain

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

Quick start

from langchain.tools import tool
from langchain_community.document_loaders import WebBaseLoader
import requests

@tool
def get_sitemap_urls(domain: str) -> list[str]:
    """Get all URLs from a domain's sitemap using SitemapKit API."""
    resp = requests.post(
        "https://sitemapkit.com/api/v1/sitemap/full",
        headers={"x-api-key": "YOUR_API_KEY", "Content-Type": "application/json"},
        json={"url": domain}
    )
    return [u["loc"] for u in resp.json()["urls"]]

# Use in a RAG pipeline
urls = get_sitemap_urls.invoke("docs.example.com")
loader = WebBaseLoader(urls[:50])  # Load first 50 pages
docs = loader.load()

# Now index docs into your vector store
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings

vectorstore = FAISS.from_documents(docs, OpenAIEmbeddings())

Continue with SitemapKit

Start using SitemapKit with LangChain

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

More AI Frameworks integrations