TypeScript-Ready Node.js Integration
ProxyTurk Node.js SDK offers full type safety with TypeScript. Includes a Promise-based API, automatic retries, and webhook verification helpers.
import { ProxyTurk } from '@proxyturk/sdk';const client = new ProxyTurk({ apiKey: process.env.PROXYTURK_API_KEY!,});// Web Scraping (sync)const scrapeResult = await client.scrape({ url: 'https://example.com', formats: ['markdown', 'screenshot'], wait: true,});console.log(scrapeResult.data.markdown);// AI Parser (sync)const parseResult = await client.parse({ url: 'https://example.com/product', prompt: 'Extract product name, price, and stock status', schema: { name: 'string', price: 'number', inStock: 'boolean' }, wait: true,});console.log(parseResult.data);// SERP API (sync)const serpResult = await client.serp({ query: 'best proxy provider', engine: 'google', location: 'Turkey', wait: true,});serpResult.data.organic.forEach((item) => { console.log(`${item.position}. ${item.title}`);});Requires Node.js 18+. Install with npm or yarn:
npm install @proxyturk/sdk # or yarn add @proxyturk/sdk
TypeScript type definitions are included, no additional @types package needed.
Create a ProxyTurk client and send your first request. Store your API key as an environment variable.
With wait: true option, the Promise resolves when the result is ready. Ideal for simple scripts and small projects.
submitParse/submitScrape/submitSerp methods immediately return a job_id. Use waitForJob() to poll for the result.
Use the verifyWebhook() helper function to verify incoming webhooks are genuinely from ProxyTurk.
The SDK throws custom Error classes:
- ApiError: General API error - AuthError: 401/403 authentication error - RateLimitError: 429 rate limit exceeded (includes retryAfter) - InsufficientCreditsError: 402 insufficient credits - JobTimeoutError: Async job timeout
All error classes extend ApiError.
Questions about Node.js SDK
Node.js 18 and above are supported. Fetch API is required, hence Node.js 18+.
The SDK is distributed as ESM. In CommonJS projects, use dynamic import: const { ProxyTurk } = await import("@proxyturk/sdk")
Yes, the SDK uses standard Web APIs (fetch, crypto), making it compatible with Bun and Deno.