SerpBase
AI Engineers, Agent Builders, LLM App Developers

Web Search & Real-Time Data API for AI Agents

Ground LLMs with fresh web knowledge, social posts, and e-commerce data using structured JSON tool calling.

Why Developers Build on SerpBase

Token-Optimized Structured JSON

Receive clean markdown and concise JSON objects directly ingestible by LLM context windows, eliminating raw HTML token bloat.

Synchronous Results for Live Agents

Each call returns its JSON result in the same HTTPS request, so an agent can use search and scrape results within a single tool call.

Model Context Protocol (MCP) Support

Plug-and-play MCP server integration compatible with Claude Desktop, Codex, OpenClaw, and custom agent tool harnesses.

Unified Multi-Platform Credit Pool

Access Google, DuckDuckGo, TikTok, X, and Web scrapers with a single API key and shared credit balance.

Integration Example

PYTHONZero External Dependencies
import requests

def search_web_for_agent(query: str, api_key: str):
    response = requests.post(
        "https://api.serpbase.dev/google/search",
        headers={"X-API-Key": api_key, "Content-Type": "application/json"},
        json={"q": query, "num": 5, "gl": "us", "hl": "en"}
    )
    data = response.json()
    # Feed organic snippets straight to the LLM prompt
    return [{"title": r["title"], "snippet": r["snippet"], "link": r["link"]} for r in data.get("organic", [])]

Featured Endpoints for this Solution

DuckDuckGo Search

Search DuckDuckGo HTML results by query, with supported market and date filters. Continuation uses the returned cursor, not numbered pages.

1 creditsDocs

TikTok Post

Request a specific TikTok post using its ID and username. This is a post lookup, not profile-wide post discovery.

2 creditsDocs

X Post Details

Look up one X post by ID. This is not an X keyword search, timeline export or streaming endpoint.

1 creditsDocs

Web Scrape

Extract a public HTTP or HTTPS page by URL, with supported text, HTML, Markdown and selector options. Source restrictions still apply.

1 creditsDocs

Frequently Asked Questions

How do I integrate SerpBase with LangChain or OpenAI?

SerpBase endpoints return deterministic JSON. Define a function or tool in your agent definition that calls POST https://api.serpbase.dev/google/search or /web/scrape with your API key in the X-API-Key header.

What happens if a requested page or post does not exist (404)?

SerpBase returns a clean 200 HTTP response with status: 0 and no_results: true, allowing your agent to gracefully recognize missing data without crashing on exceptions.