SDKs
JavaScript / TypeScript SDK

JavaScript / TypeScript SDK

A typed, promise-based client over every SuperScraper endpoint.

⚠️

Not published. @superscraper/sdk does not exist on npm, so npm install @superscraper/sdk will fail. The source lives in this repository at packages/sdk-node; everything below describes that source, not an installable release.

Use the REST API instead

Node 18+ has global fetch, so the same call takes no dependencies at all:

const res = await fetch('https://api.superscraper.dev/v1/scrape', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.SUPERSCRAPER_API_KEY!,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ url: 'https://example.com' }),
});
const page = await res.json();
console.log(page.markdown);

See the Quickstart and the API reference for every endpoint and parameter.

Running the source locally

Clone the repository and reference packages/sdk-node as a workspace or file dependency. Requires Node.js 18+ (uses global fetch and AbortSignal.timeout).

Scrape in 5 lines

import { SuperScraper } from '@superscraper/sdk';
 
// Reads SUPERSCRAPER_API_KEY from the environment (or pass it as the first arg).
const client = new SuperScraper(process.env.SUPERSCRAPER_API_KEY);
 
const page = await client.scrape('https://example.com');
console.log(page.markdown);

Constructor

new SuperScraper(apiKey?: string, baseUrl?: string)
ParamDefaultEnv var
apiKey, (throws if missing)SUPERSCRAPER_API_KEY
baseUrlhttps://api.superscraper.devSUPERSCRAPER_BASE_URL

More calls

// Structured extraction with an LLM schema
const extracted = await client.extract('https://example.com/product', {
  schema: { name: 'string', price: 'number', description: 'string' },
});
console.log(extracted.data);
 
// Pre-built Google Maps scraper
const leads = await client.scrapeGoogleMaps({
  query: 'plumbers',
  location: 'Austin, TX',
  maxResults: 20,
});
console.log(leads.results);
 
// Enrich a domain
const enriched = await client.enrichWebsite('acme.com');
console.log(enriched.emails, enriched.tech_stack);

Method map

MethodEndpoint
client.scrape(url, opts?)POST /v1/scrape
client.extract(url, opts?)POST /v1/extract
client.crawl(url, opts?)POST /v1/crawl
client.getCrawlStatus(jobId)GET /v1/jobs/:id
client.map(url, opts?)POST /v1/map
client.batch(urls, opts?)POST /v1/batch
client.screenshot(url, opts?)POST /v1/screenshot
client.search(query, opts?)POST /v1/search
client.scrapeGoogleMaps(opts)POST /v1/scrapers/google-maps
client.enrichWebsite(domain)POST /v1/enrich/website

See the API Reference for every parameter each method accepts.