The @socialrouter/sdk package provides a typed client for the SocialRouter API. It handles authentication, error mapping, and optional polling for async extractions.

Installation

npm install @socialrouter/sdk

Quick example

import { SocialRouter } from "@socialrouter/sdk";

const sr = new SocialRouter({ apiKey: "sr_live_your_key" });

const extraction = await sr.extract({
  url: "https://www.linkedin.com/in/satyanadella",
  provider: "apify/linkedin/profile.info",
});

console.log(extraction.data);
// [{ name: "Satya Nadella", title: "Chairman and CEO at Microsoft", ... }]

What’s included

  • Typed client with full TypeScript support — covers extract, search, providers, account
  • Batch URLs on extract via the urls[] option for batch-capable actors
  • Per-call fallback control with the fallback flag (default true)
  • Error classes for each HTTP status (AuthenticationError, InsufficientCreditsError, RateLimitError)
  • Polling helpers via extractAndWait() and searchAndWait()
  • Uses native fetch() — requires Node.js 18+
For query-driven services (e.g. Google Maps place search), use search / searchAndWait:
const result = await sr.searchAndWait({
  queries: ["coffee shops in Brooklyn"],
  provider: "apify/googlemaps/place.search",
});

Next steps

Client reference

All methods, parameters, and return types.

Error handling

Error classes and how to handle failures.