View the TypeScript SDK GitHub repository for the latest installation instructions, examples, and source code.
- Fully typed targets and parameters with IDE autocomplete
- Sync, async, and batch scraping methods
- Native
fetchsupport; requires Node.js 18 or later - Typed error hierarchy for safer integrations
What is the Decodo TypeScript SDK?
The Decodo TypeScript SDK provides a typed interface for interacting with Decodo targets like Google, Amazon, TikTok, Reddit, YouTube, ChatGPT, Perplexity, and more. Instead of manually constructing HTTP requests and validating payloads, you work with fully typed methods and target-specific parameters directly in your editor.Why use the SDK?
- Strong typing and autocomplete – target parameters are fully typed for better editor support and fewer mistakes.
- Unified scraping interface – work with search engines, eCommerce platforms, social media, and AI tools through one SDK.
- Async and batch workflows – create scraping tasks, poll task status, and process batches at scale.
- Typed errors – handle authentication, validation, timeout, and rate-limit failures safely.
- Minimal setup – uses native
fetch, no additional HTTP client required.
Requirements
- Node.js 18 or later, for native
fetch - TypeScript 5.0 or later, recommended for best type inference
Installation
Quick start
Create a new project:main.js and initialize the client with the environment variable:
Configuration
Web Scraping API
Access the API viaclient.webScrapingApi. The examples below assume Target is already imported, along with DecodoClient where needed:
Sync scrape
Waits for the scraping result before returning:Async scrape
Creates a scraping task and returns immediately. Poll separately for task status and results:Batch scrape
Send multiple queries or URLs in a single request:Supported targets
Each target accepts one primary input parameter (url, query, product_id, or prompt) together with optional configuration.
Search engines
eCommerce
Social media
AI tools
Universal scraping
Target.UniversalEcommerce isn’t included in the table because it doesn’t accept a primary input parameter such as url, query, product_id, or prompt. It only accepts optional configuration fields such as callback_url.Error handling
The SDK throws typed errors that map to API error codes:AuthenticationError, RateLimitError, and ValidationError extend DecodoError. TimeoutError sits outside the DecodoError hierarchy, so handle it separately.
Related
- CLI – Run Decodo scraping workflows from the command line.
- Python SDK – Integrate the Web Scraping API into Python projects.
- Go SDK – Integrate the Web Scraping API into Go projects.
- MCP Server – Connect AI agents and MCP-compatible tools to Decodo.
- GitHub repository – View the TypeScript SDK source code, examples, and latest releases.
Support
Need help or just want to say hello? Our support is available 24/7.
You can also reach us anytime via email at support@decodo.com.
You can also reach us anytime via email at support@decodo.com.
Feedback
Can’t find what you’re looking for? Request an article!
Have feedback? Share your thoughts on how we can improve.
Have feedback? Share your thoughts on how we can improve.