Python SDK

Web search API for Python

The official Python client covers every endpoint in the public API. It handles authentication, timeouts, retries on rate limits, and the polling a deepcrawl task needs, so your code stays about the search rather than the transport.

Install β€” bash
pip install search1api
export SEARCH1API_API_KEY="your-api-key"
What the client handles

Authentication, timeouts, retries and deepcrawl polling are already written, so your code stays about the search.

1
Every endpoint, one client

search, news, crawl, screenshot, sitemap, trending, extract and deepcrawl.

2
Errors you can branch on

Separate types for auth, credits, validation, rate limits and server failures.

3
Async when you need it

AsyncSearch1API offers the same operations for asyncio code.

Covers

search / news / crawl / screenshot / extract / deepcrawl

Searching the web from Python

A web search API returns structured results your program can read: a title, a link, and text for each hit, rather than an HTML page you have to parse. That matters most in Python, where the alternative is scraping a results page and re-writing the parser every time the markup shifts. Search1API returns JSON from one endpoint across more than a dozen sources, and can attach the full text of the top results to the same response when snippets are not enough.

What the client handles for you

Every endpoint, one client

Search, news, crawl, screenshot, sitemap, trending, extract, and deepcrawl are all methods on the same object, covering the public OpenAPI contract.

Errors you can branch on

Separate error types for authentication, credits, validation, not found, rate limits, and server failures, each carrying the status code and the parsed body.

Retries where retrying is safe

A 30-second timeout, with 429 and transient 5xx retried twice. Authentication, payment, and validation errors are never retried, and neither is starting a deepcrawl task.

Async when you need it

AsyncSearch1API exposes the same operations for asyncio code, usable as an async context manager.

Binary responses kept intact

Screenshot returns image bytes rather than JSON; the client preserves the content type and request ID alongside the body.

Deepcrawl without a polling loop

One call starts the task and waits for it. Separate start, status, and wait methods are there when the task ID has to be persisted.

Quick start

Create a key in the dashboard, put it in the environment, and search. Setting crawl_results returns the top matches as full page text in the same call.

search.py β€” python
from search1api import Search1API
​
client = Search1API() # reads SEARCH1API_API_KEY
​
response = client.search(
"latest AI agent frameworks",
max_results=10,
crawl_results=3,
)
​
for result in response["results"]:
print(result["title"], result["link"])

Deepcrawl without hand-written polling

Starting a crawl of a whole site normally means starting a task, polling for status, and handling the wait yourself. The client does that in one call and hands back the finished archive URL.

deepcrawl.py β€” python
result = client.deepcrawl("https://example.com", type="all")
print(result["zipUrl"])

Endpoints it covers

The same credits apply whichever way you call them: 1 credit for a search or news request, plus 1 for each page successfully retrieved.

What people build with it

RAG pipelines that pull live web context alongside an internal index.

Research scripts that query several sources and write the findings to a file.

Scheduled jobs that watch news on a topic and post a digest.

Data collection that reads the page behind a result rather than the snippet.

Agent tools wrapped around the client for whichever framework you use.

FAQ

How do I search the web from Python?

Install the search1api package, set SEARCH1API_API_KEY in the environment, and call client.search("your query"). The response is a dict with a results list, each entry carrying a title, link, and text. No HTML parsing and no scraping.

Does it work with async code?

Yes. AsyncSearch1API offers the same operations for asyncio and works as an async context manager, so it fits into an existing event loop without a thread pool.

What happens on a rate limit?

A 429 is retried twice automatically, as are transient 5xx responses. Authentication, payment, and validation errors are raised immediately rather than retried, because retrying them cannot help.

Which search engines can I use?

Google, Bing, DuckDuckGo, Yahoo, GitHub, arXiv, Reddit, X, YouTube, Wikipedia, IMDb, WeChat, Bilibili, Baidu, 360, and Quark. Pass the one you want as search_service on the request.

Is there a free tier?

New accounts get 100 credits free with no card, which is 100 searches. A search or news request is 1 credit, and each page successfully retrieved adds 1 more.

Explore more

Start searching from Python

Two lines to install, 100 free credits to try it with, no credit card.