Node SDK
The official @datablue/sdk package is a typed async SDK for Node.js, TypeScript, and modern JavaScript runtimes.
It defaults to https://api.datablue.dev and sends your API key as a Bearer token.
Install
Example
npm install @datablue/sdkScrape
Example
import { DataBlue } from "@datablue/sdk";
const client = new DataBlue({ apiKey: "wh_your_api_key" });
const result = await client.scrape("https://example.com", {
formats: ["markdown", "links"],
});
console.log(result.data?.markdown);Extract with Gemini
Example
const result = await client.scrape("https://example.com/pricing", {
formats: ["markdown"],
extract: {
provider: "gemini",
prompt: "Extract pricing tiers",
schema: {
type: "object",
properties: {
tiers: {
type: "array",
items: {
type: "object",
properties: {
name: { type: "string" },
price: { type: "string" },
},
},
},
},
},
},
});
console.log(result.data?.extract);Crawl and Map
Example
const crawl = await client.crawl("https://docs.example.com", {
maxPages: 20,
maxDepth: 2,
scrapeOptions: { formats: ["markdown"] },
});
const urls = await client.mapUrl("https://docs.example.com", {
limit: 100,
});
console.log(crawl.status, urls.links.length);Data API Jobs
Some heavy Data APIs return a queued job_id and status_url. Use getDataJobStatus() to poll the native Data API job endpoint.
Example
const job = await client.amazonStore({
url: "https://www.amazon.com/stores/example",
});
const status = await client.getDataJobStatus(job.job_id);
console.log(status.status);Configuration
| Option | Default | Description |
|---|---|---|
apiUrl | https://api.datablue.dev | Base URL of the DataBlue API |
apiKey | — | API key with wh_ prefix |
timeout | 60000 | Request timeout in milliseconds |
maxRetries | 3 | Max retries on transient network and server errors |
