Web Search API Quickstart
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.
The Python sample follows the SDK default and prints contents.highlights. The TypeScript and curl calls omit extraction, so raw POST /v1/search returns snippets. you.search() in the Python SDK 3.6.0 and later sends knowledge="core" and extraction={"extraction_mode": "highlights"} when you pass neither argument, and snippets is None. Knowledge adds no extra charge. See Billing.
Pass both arguments as None for snippets:
Highlights accepts count up to 50. The SDK default uses highlights, so a count above 50 needs extraction=None or extraction_mode set to full_page.
A raw POST /v1/search call returns JSON like this:
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 Highlights
Snippets are the HTTP default. Raw POST /v1/search returns them when the body omits extraction. The Python SDK 3.6.0 and later defaults to highlights and knowledge="core", so you.search() returns contents.highlights and snippets is None. Pass knowledge=None and extraction=None for snippets. The sample sets extraction_mode to highlights, which is what an HTTP client sends for the same excerpts.
Add Full Page Content
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.