🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@scrapio/api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scrapio/api

Official TypeScript SDK for the Scrapio

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
79
-83.23%
Maintainers
1
Weekly downloads
 
Created
Source

@scrapio/api

Official TypeScript / Node.js SDK for Scrapio — fetch, crawl, search, and extract structured data from any URL.

Install

npm install @scrapio/api

Requires Node.js 18 or later. Ships with ESM and CJS builds and full TypeScript types.

Quickstart

import { ApiClient } from "@scrapio/api";

const client = new ApiClient({ apiKey: process.env.SCRAPIO_API_KEY! });

const result = await client.fetch.fetch({
  url: "https://example.com",
  output: ["markdown"],
});

console.log(result.outputs.markdown);

Usage

Fetch a page

const result = await client.fetch.fetch({
  url: "https://news.ycombinator.com",
  render_js: true,
  output: ["markdown"],
});
const results = await client.google.search({
  search: "best web scraping API 2025",
  country_code: "us",
  search_type: "classic",
});
console.log(results.organic_results);
const results = await client.fastSearch.search({
  search: "best web scraping API 2025",
  country_code: "us",
});
console.log(results.organic_results);

Amazon product

const product = await client.amazon.getProduct({ asin: "B08N5WRWNW" });
console.log(product.title, product.price);
const items = await client.walmart.search({ query: "headphones" });

YouTube transcript

const video = await client.youtube.getVideo({ video_id: "dQw4w9WgXcQ" });

Browser automation

const result = await client.interact.interact({
  url: "https://example.com",
  actions: [
    { type: "click", selector: "#login" },
    { type: "type", selector: "#email", value: "user@example.com" },
  ],
});

Crawl a site

const result = await client.crawl.crawl({
  seeds: ["https://docs.example.com"],
  max_pages: 50,
});

Async jobs

const job = await client.jobs.create({
  kind: "fetch",
  input: { url: "https://example.com", output: ["markdown"] },
});

const result = await client.jobs.waitForCompletion(job.job_id, {
  pollIntervalMs: 2000,
  timeoutMs: 120_000,
});

Configuration

OptionTypeDefaultDescription
apiKeystringrequiredYour API key
baseUrlstringhttps://api.scrapio.devOverride for local/staging
timeoutMsnumber30000Per-request timeout
maxRetriesnumber3Max retries on 429/503

Error handling

import {
  ApiClient,
  AuthError,
  RateLimitError,
  CreditsExhaustedError,
  ApiError,
} from "@scrapio/api";

try {
  await client.fetch.fetch({ url: "https://example.com" });
} catch (err) {
  if (err instanceof AuthError) {
    console.error("Invalid API key");
  } else if (err instanceof CreditsExhaustedError) {
    console.error("No credits remaining");
  } else if (err instanceof RateLimitError) {
    console.error("Rate limited — back off and retry");
  } else if (err instanceof ApiError) {
    console.error(`API error ${err.statusCode}: ${err.message}`);
  }
}

License

MIT

FAQs

Package last updated on 31 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts