npm - TypeScript / JavaScript
Node.js SDK
First-class TypeScript types for every product field, Promise-based async API, retry middleware. Works in Node, Bun, Deno, Cloudflare Workers, and any modern runtime.
Quick start
1. Install
npm install chocodata 2. Scrape your first product
import { Chocodata } from "chocodata";
const chocodata = new Chocodata("asa_live_YOUR_KEY");
const product = await chocodata.amazon.product({ query: "0143127748" });
console.log(product.asin, product.title); 3. TypeScript autocomplete works out of the box
// product is typed as Product
// product.price is typed as number | null
// product.images is typed as string[]
// IDE shows every field How-to
Run a search
const results = await chocodata.amazon.search({ query: "wireless earbuds" });
for (const p of results.products) {
console.log(p.title, p.price);
}
// Bing takes 'q', not 'query'
const web = await chocodata.bing.search({ q: "wireless earbuds", count: 10 });
for (const r of web.organic_results) {
console.log(r.title, r.url);
} Scrape many items concurrently
const asins = ["0143127748", "B09B8V1LZ3", "B0BSHF7WHW"];
const results = await Promise.all(
asins.map((query) => chocodata.amazon.product({ query })),
);
console.log(`got ${results.length} products`); Run on Cloudflare Workers
// worker.ts
import { Chocodata } from "chocodata";
export default {
async fetch(req: Request, env: Env) {
const chocodata = new Chocodata(env.CHOCODATA_API_KEY);
const reqUrl = new URL(req.url);
const id = reqUrl.searchParams.get("id");
if (!id) return new Response("missing id", { status: 400 });
const product = await chocodata.amazon.product({ query: id });
return Response.json(product);
}
}; SDK uses fetch() under the hood, no Node-only APIs. Works on every modern edge runtime.
Why use the SDK over raw fetch?
First-class TypeScript
Each endpoint's parameters are typed with its real contract, so the compiler catches passing query to an endpoint that wants url.
Retry middleware
Exponential backoff with jitter on 429, 5xx and network errors. A 404 is never retried. Only 2xx responses bill, so retries cost nothing.
Universal runtime
Works in Node 18+, Bun, Deno, Cloudflare Workers, Vercel Edge, and the browser. No Node-only dependencies.
Structured errors
Failures throw a ChocodataError with the status, the API error code, the request id, and the server's own retryable flag.
Every endpoint reachable
chocodata.scrape(target, resource, params) reaches all 499 endpoints, including any without a typed method yet.
Zero dependencies
Zero runtime dependencies. The published package is under 7 kB.
Official resources
- GitHub repo - source + issues + changelog
- npm package - install via npm / yarn / pnpm
- Product API reference
- Search API reference
- Async batch API reference
Pricing
Same rate across every integration. Monthly plans from $19 or pay-as-you-go at $0.90 per 1,000 successful requests. 1,000 free on signup.
Free
Forever free on signup
- check_circle1,000 requests (5,000 credits), one-time
- check_circle10 concurrent requests
- check_circleAll 237 targets
- check_circleFull dashboard + analytics
- check_circleTop-up at $0.90 / 1k
- check_circleCommunity support
Vibe
$0.70 / 1k effective
- check_circle27,000 requests / month (135,000 credits)
- check_circle30 concurrent requests
- check_circleAll 237 targets + content-language
- check_circleCountry-matched residential IPs
- check_circlePer-API-key usage tracking
- check_circleTop-up at $0.90 / 1k
- check_circleEmail support (1 business day)
Pro
$0.60 / 1k effective
- check_circle82,000 requests / month (410,000 credits)
- check_circle50 concurrent requests
- check_circlePriority routing queue
- check_circleCountry-matched residential IPs
- check_circleTeam seats (up to 5)
- check_circleTop-up at $0.90 / 1k
- check_circleEmail + chat support
Custom
Flat $0.50 / 1k effective at every level
- check_circle200k - 4M+ requests / month
- check_circle100-500+ concurrent requests
- check_circlePriority queue (highest)
- check_circlePremium proxy pool + SLA on request
- check_circleUnlimited team seats
- check_circleWire / invoice / annual PO
- check_circleDedicated Slack channel
Pay-as-you-go top-up
$0.90 / 1,000 successful requests
Available on every plan including Free. Top up any time when included credits run out. Only 2xx responses charged. Balance never expires.
Ship with Node today
1,000 free requests on signup. No credit card required.