TypeScript SDK

Web search API for Node.js and TypeScript

The official TypeScript client covers every endpoint in the public API with typed responses, so a result field that does not exist is a compile error rather than a runtime surprise. Authentication, timeouts, retries, and deepcrawl polling are handled for you.

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

Typed against the public contract, with authentication, retries and deepcrawl polling already written.

1
Typed end to end

Requests and responses typed against the public OpenAPI contract.

2
Errors you can catch

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

3
Runs beyond Node

Node.js 18+ and any runtime with a standards-compatible fetch.

Covers

search / news / crawl / screenshot / extract / deepcrawl

Searching the web from Node.js

A web search API returns structured results your code can read: a title, a link, and text per hit, instead of an HTML page you would have to parse. In TypeScript that structure is worth more than convenience, because the response shape is typed and the compiler catches a wrong field before you ship it. Search1API returns JSON from one endpoint across more than a dozen sources, and can attach full page text to the top results in the same response.

What the client handles for you

Typed end to end

Requests and responses are typed against the public OpenAPI contract, so your editor knows the option names and the result fields.

Every endpoint, one client

Search, news, crawl, screenshot, sitemap, trending, extract, and deepcrawl are all methods on the same instance.

Error classes you can catch

Separate classes 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.

Runs beyond Node

Node.js 18 and above, plus any runtime with a standards-compatible fetch, so the same client works in edge and worker environments.

Deepcrawl without a polling loop

One await starts the task and resolves when it finishes. Separate start, status, and wait methods are there when the task ID has to be persisted.

Quick start

Create a key in the dashboard, pass it to the constructor, and search. Setting crawlResults returns the top matches as full page text in the same call.

search.ts β€” ts
import { Search1API } from '@search1api/client';
​
const client = new Search1API({
apiKey: process.env.SEARCH1API_API_KEY,
});
​
const response = await client.search('latest AI agent frameworks', {
maxResults: 10,
crawlResults: 3,
});
​
for (const result of response.results) {
console.log(result.title, result.link);
}

Deepcrawl without hand-written polling

Crawling a whole site normally means starting a task, polling for status, and writing the wait yourself. The client does it in one await and resolves with the finished archive URL.

deepcrawl.ts β€” ts
const result = await client.deepcrawl('https://example.com', {
type: 'all',
});
​
console.log(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

Next.js route handlers that answer with live web evidence and cite it.

Agent tools wrapped around the client for the AI SDK or another framework.

Background jobs that watch a topic and post a digest to Slack.

Enrichment that reads the page behind a domain rather than guessing.

Edge functions that need search without a Node-only dependency.

FAQ

How do I search the web from Node.js?

Install @search1api/client, construct it with your API key, and await client.search("your query"). The response is a typed object with a results array, each entry carrying a title, link, and text. No HTML parsing and no scraping.

Does it work outside Node.js?

Yes. It supports Node.js 18 and above and any runtime with a standards-compatible fetch implementation, which covers edge and worker environments.

What happens on a rate limit?

A 429 is retried twice automatically, as are transient 5xx responses. Authentication, payment, and validation errors reject immediately rather than retrying, 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 searchService 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 Node.js

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