Skip to navigation

Web Search API Quickstart

Make your first Web Search API request in minutes.
View as MarkdownOpen in Claude

The Web Search API returns real-time web and news results as structured, LLM-ready JSON. Feed the results into your prompt to ground a model in fresh information.

Get an API key at you.com/platform. The samples below read YDC_API_KEY. See the site Quickstart for the five-API tour and API key management for best practices.

from youdotcom import You
with You() as you:
results = you.search(query="global birth rate trends", count=5)
for result in results.results.web:
print(result.title)
print(result.url)
if result.snippets:
print(result.snippets[0])

You’ll get back structured JSON like this:

{
"results": {
"web": [
{
"url": "https://www.worldbank.org/en/topic/population",
"title": "Population | World Bank",
"description": "The World Bank tracks global birth rate and population trends.",
"snippets": [
"Global fertility rates have declined significantly over the past five decades, falling from an average of 5 births per woman in 1960 to around 2.3 today."
],
"page_age": "2025-10-01T00:00:00",
"favicon_url": "https://ydc-index.io/favicon?domain=worldbank.org&size=128"
}
]
},
"metadata": {
"query": "global birth rate trends",
"search_uuid": "a1b2c3d4-0000-0000-0000-000000000000",
"latency": 0.38
}
}
TypeScript, MCP, or the Python SDK

TypeScript and JavaScript have three paths. Use fetch against the REST APIs when the application needs the JSON. Use @youdotcom-oss/mcp, or the hosted server at https://api.you.com/mcp, when an agent should call the tools. Use the Python SDK when you want a typed client that tracks new API fields. The @youdotcom-oss/sdk package is deprecated.

Add Full Page Content

Search results already include snippets. Use extraction with extraction_mode: "full_page" to attach clean Markdown or HTML for each result. See Retrieve page content for highlights, cache vs. live crawl, and pricing.

from youdotcom import You
from youdotcom.models import Extraction, ExtractionFormat, ExtractionMode
with You() as you:
results = you.search(
query="global birth rate trends",
count=5,
extraction=Extraction(
extraction_mode=ExtractionMode.FULL_PAGE,
full_page={"extraction_formats": [ExtractionFormat.MARKDOWN]},
),
)
for result in results.results.web:
if result.contents and result.contents.markdown:
print(result.title)
print(result.contents.markdown[:400])

Next Steps