Skip to main content
Skip to content
ScrapingBuddyDevelopers
On this page 1. Sign in, fund your wallet and create a key

Scraping API/Guides

Your first scrape

Go from a public URL to saved page content in four steps.

1. Sign in, fund your wallet and create a key

During the current testing stage, sign in and use a public URL without separate account or hostname approval. Start with at least $1 available wallet balance. A provider-completed page costs $0.00045, with AI and web search billed separately when requested; temporary holds reduce available credit.

For API integration, create a customer API key in Profile > API access. Keep it on your server. These examples create live, billed tasks, not sandbox requests. The initial example omits analysis and does not call AI.

Bash / environment setup
export SCRAPINGBUDDY_API_KEY="YOUR_API_KEY"
export SCRAPINGBUDDY_TARGET_URL="https://YOUR_PUBLIC_HOST/about"
# Generate once; save this key and request before sending.
export SCRAPINGBUDDY_TASK_KEY="$(node -p 'crypto.randomUUID()')"

2. Submit one page

Replace the placeholder below with your public URL and save the JSON as request.json for the cURL example. JavaScript and Python read SCRAPINGBUDDY_TARGET_URL instead.

Send the request once and save task.id from the response. A 202 means accepted for processing, not finished. The task ID is the same UUID v4 you supplied as Idempotency-Key.

request.json / replace the URL
{
  "url": "https://YOUR_PUBLIC_HOST/about",
  "format": "markdown"
}
POST /scraping/tasks
# Save request.json with your public URL and format first.
# Reuse this file and the saved key for an uncertain retry.
curl --fail-with-body -X POST "https://www.scrapingbuddy.com/api/v1/scraping/tasks" \
  -H "Authorization: Bearer $SCRAPINGBUDDY_API_KEY" \
  -H "Idempotency-Key: $SCRAPINGBUDDY_TASK_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @request.json

Examples use Bash, Node.js 20+, or Python with requests. View request and response fields.

3. Wait, then check your task

Wait at least 6 seconds, then fetch the saved task ID. Continue checking queued, submitting, processing, researching or analyzing tasks at that interval. GET reads progress; do not POST a new task to check progress.

The example checks once. In your application, use a bounded polling loop and preserve the task ID if you stop waiting. For 429, honor Retry-After. Stop on ready, failed, review or expired.

Bash / fetch the saved task
export SCRAPINGBUDDY_TASK_ID="$SCRAPINGBUDDY_TASK_KEY"
sleep 6
curl --fail-with-body \
  "https://www.scrapingbuddy.com/api/v1/scraping/tasks/$SCRAPINGBUDDY_TASK_ID" \
  -H "Authorization: Bearer $SCRAPINGBUDDY_API_KEY"

4. Read and save the result

When task.status is ready, task.content contains your HTML or Markdown. Inspect task.warning: a wait condition may not have been satisfied even when content is returned.

Save content to your own storage before contentExpiresAt, 24 hours after page collection. Treat source content as untrusted text. Sanitize HTML before displaying it; do not run scripts from scraped pages.

If task.status is failed, inspect task.error.code and task.error.message. For review, contact support with task.id and do not create a replacement request.

A bounded polling loop

This Node.js example only reads a saved task. It never creates a replacement or charges for another scrape. Stop locally after ten minutes and keep the task ID; stopping polling does not cancel queued or in-flight server work. The thirty-second fetch timeout limits one network exchange, not page rendering.

ready means page content is available, not that optional AI succeeded. Inspect task.error and task.analysis.status too: insufficient funds or a failed model call can leave usable content with an incomplete analysis.

Node.js / fetch an existing task
const apiKey = process.env.SCRAPINGBUDDY_API_KEY;
const taskId = process.env.SCRAPINGBUDDY_TASK_ID;
if (!apiKey || !taskId) throw new Error("Set your API key and saved task ID.");
const active = new Set(["queued", "submitting", "processing", "researching", "analyzing"]);
const deadline = Date.now() + 10 * 60_000;
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
let result;
while (Date.now() < deadline) {
  const response = await fetch(
    "https://www.scrapingbuddy.com/api/v1/scraping/tasks/" + encodeURIComponent(taskId),
    { headers: { Authorization: "Bearer " + apiKey }, signal: AbortSignal.timeout(30_000) }
  );
  if (response.status === 429 || response.status >= 500) {
    const seconds = Math.max(6, Number(response.headers.get("Retry-After")) || 60);
    await sleep(Math.min(seconds * 1000, Math.max(0, deadline - Date.now())));
    continue;
  }
  const data = await response.json();
  if (!response.ok) throw new Error(response.status + ": " + data.error);
  if (!active.has(data.task.status)) { result = data.task; break; }
  await sleep(Math.min(6000, Math.max(0, deadline - Date.now())));
}
if (!result) throw new Error("Stopped waiting. Resume later with task ID " + taskId);
if (result.status !== "ready") {
  throw new Error(JSON.stringify({ id: taskId, status: result.status, error: result.error }));
}
console.log(result);
Scraping API v1
Getting startedIntroductionYour first scrapeAuthentication & access
GuidesBulk classificationAI analysis & company contextFormats & page readinessTask lifecycle & retentionSafe retriesErrors, limits & billing

Explore the documentation

Scraping APIIntroduction

Public pages, HTML, Markdown, deep research, bulk classification, wallet billing and first integration.

GuidesBulk classification

One question, your own answer labels, and a separate machine-readable result for each website.

GuidesYour first scrape

Go from a public URL to saved page content in four steps.

GuidesAuthentication & access

Connect your server with your customer API key and understand public-page access.

GuidesAI analysis & company context

Extract information, summarize a page or assess relevance with optional OpenAI analysis.

GuidesFormats & page readiness

Choose the content format and when the page is ready to collect.

GuidesTask lifecycle & retention

Know when to poll, when to save content and when to stop.

GuidesSafe retries

Recover a lost response without accidentally creating another task.

GuidesErrors, limits & billing

Understand request failures, task failures and usage-based billing.

POST /scraping/tasksCreate a task

Collect a public page, with optional single-page or deep analysis. During the current testing stage, a valid customer API key is enough to create a public-page task; separate accou

GET /scraping/tasks/{id}Get a task & result

Read task progress and retrieve content when it is ready. Fetch the saved task ID with the same account that created it. Wait at least 6 seconds between progress checks. This reque

GET /scraping/tasksList task history

Find your recent tasks, newest first, without downloading page content. Returns up to 10 tasks per page, ordered by creation time and ID, plus hasMore. Request offset=0, then 10, t

POST /scraping/classificationsCreate a classification batch

Ask one question across up to 100 URLs and constrain answers to your own labels. Send a saved UUID v4 Idempotency-Key and JSON body of at most 256 KiB. The key becomes batch.id. An

GET /scraping/classifications/{id}Get classification results

Retrieve batch progress and all per-URL decisions. Use the batch ID and a key belonging to the same account. Poll at least 10 seconds apart. Returns 202 while queued or running, an

GET /scraping/classificationsList classification batches

Read paginated batch summaries and current classification availability. Returns up to 10 batches, newest first, without items. Use offset=0, then 10, then 20 while hasMore is true.

POST /scraping/classifications/{id}/cancelStop queued classification URLs

Stop batch items that have not started; let in-flight work finish. Send Authorization only; no request body or new Idempotency-Key is required. Repeating cancellation is safe. Only