Python SDK
We offer a Python SDK to make interacting with our APIs simple and predictable. It covers the Web Search, Answer, Contents, Research, and Finance Research APIs, and is available on PyPI here. Now you can get started with our APIs with just a few lines of code.
This documentation ships with a Docs MCP Server that gives any MCP-enabled agent a searchDocs tool to search every page here and get back relevant passages with source URLs—no API key required. Point your client at https://you.com/docs/_mcp/server. See the Docs MCP Server guide for setup and examples.
Quickstart
That’s it. You now have a comprehensive set of search results combining web and news sources.
What’s next?
The Web Search API offers filters that can help you find exactly what you need, whether you want to go broader or narrower. For example, to find recent information in the United States about renewable energy from the past week limited to 10 results per source type, either web or news, write:
Learn more about the Web Search API in the Web Search API reference, and the Python SDK by visiting the open source repository on GitHub.
Response Structure
The Web Search API returns a SearchResponse object (see documentation):
results.web
An array of web result objects. Each object may include url, title, description, snippets, thumbnail_url, page_age, and favicon_url.
results.news
An array of news article objects. Each object may include url, title, description, thumbnail_url, and page_age.
metadata
Information about the search query and response, including query, search_uuid, and latency.
Long-Running Research
Research at deep, exhaustive, or frontier effort can run for minutes, which is long enough to exceed a client timeout or tie up a worker. Run those in background mode and let the SDK handle the task lifecycle. The helpers live in youdotcom.research_helpers, which is a separate import from the client itself.
Pick the helper that matches how your code is shaped:
Every helper has an _async counterpart (research_and_wait_async, poll_research_task_async, stream_research_async, research_background_async) for use with asyncio.
For the full background task lifecycle, including the raw endpoints behind these helpers, see the Research API guide.
Error Handling
Always handle potential errors when making API requests:
Learn More
Install and inspect the published Python SDK package.
Read the source, generated model docs, and release history.
Full Web Search API parameters and response schema.
Full Answer API parameters and response schema.