Official JavaScript/TypeScript SDK for Thordata (SERP, Universal, Web Scraper).
npm install thordata-js-sdkThe Official Node.js/TypeScript Client for Thordata APIs
Proxy Network • SERP API • Web Unlocker • Web Scraper API



---
A fully typed TypeScript SDK for Thordata, optimized for Node.js environments. It provides seamless integration with Thordata's proxy network and scraping APIs.
Key Features:
* 🔒 Type-Safe: Written in TypeScript with complete definitions.
* 🌐 Modern: Uses axios and standard https-proxy-agent for reliable connectivity.
* ⚡ Lazy Validation: Zero-config initialization; only provide credentials for the features you use.
* 🛡️ Proxy Support: Full support for HTTPS and SOCKS5h protocols with authentication.
---
``bash`
npm install thordata-js-sdkor
yarn add thordata-js-sdk
---
We recommend using dotenv to manage credentials.
`bash`.env file
THORDATA_SCRAPER_TOKEN=your_token
THORDATA_RESIDENTIAL_USERNAME=your_username
THORDATA_RESIDENTIAL_PASSWORD=your_password
THORDATA_PROXY_HOST=vpnXXXX.pr.thordata.net
---
`typescript
import { ThordataClient, Engine } from "thordata-js-sdk";
const client = new ThordataClient({}); // Auto-loads from env
async function search() {
const result = await client.serpSearch({
query: "SpaceX launch",
engine: Engine.GOOGLE_NEWS,
country: "us",
num: 5
});
console.log(result.news_results);
}
search();
`
`typescript`
async function scrape() {
const html = await client.universalScrape({
url: "https://www.g2.com/products/thordata",
jsRender: true,
waitFor: ".reviews-list",
country: "us"
});
console.log("Page HTML length:", html.length);
}
`typescript
import { Thordata } from "thordata-js-sdk";
// Create a targeted proxy config
const proxy = Thordata.Proxy.residentialFromEnv()
.country("gb")
.city("london")
.sticky(10); // 10 minutes session
const client = new Thordata();
// Request uses the proxy automatically
const response = await client.request("https://ipinfo.io/json", { proxy });
console.log(response);
`
---
`typescript
// Create a scraping task
const taskId = await client.createScraperTask({
fileName: "task_001",
spiderId: "universal",
spiderName: "universal",
parameters: { url: "https://example.com" }
});
console.log(Task ${taskId} created. Waiting...);
// Poll for completion
const status = await client.waitForTask(taskId);
if (status === "ready") {
const downloadUrl = await client.getTaskResult(taskId);
console.log("Result:", downloadUrl);
}
``
---
MIT License.