Skip to main content
Skip to content
ScrapingBuddyDevelopers
On this page Keep content collection separate from AI

Scraping API/Guides

AI analysis & company context

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

Keep content collection separate from AI

Omit analysis for HTML or Markdown only. Add an analysis object to ask a question about the collected page. Analysis runs after successful page collection, using OpenAI on the server. Your customer API key stays the same; you do not supply an OpenAI key.

Only collected sources and the instruction and company context you provide are sent to OpenAI. Do not put secrets in either field. Final analysis has no tools. Deep analysis can optionally use OpenAI web search to discover additional public sources before our bounded collection workflow retrieves them.

Describe the information you need

analysis.instruction is required when analysis is present and accepts 1-2,000 characters. Be specific about fields, summary length or classification criteria. analysis.companyContext is optional and accepts 1-3,000 characters.

The complete JSON body, including URL and all analysis fields, must fit within 8,192 bytes. Save it with your UUID v4 task key before submitting. For cURL, use this JSON as request.json; JavaScript and Python use the target URL environment variable.

request.json / content with analysis
{
  "url": "https://YOUR_PUBLIC_HOST/about",
  "format": "markdown",
  "analysis": {
    "instruction": "Extract company name, location and public email.",
    "companyContext": "We provide sustainable packaging research."
  }
}
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.

Add company context only when it helps

For relevance analysis, describe your services and target customers in companyContext, then ask the instruction to assess fit. For example: "Assess whether the company could benefit from our packaging research. Separate observed facts from inferences and list unknowns."

Context belongs to this request. It is not a saved company profile and is not automatically included in later requests. Website-based profile generation is not part of this API.

Handle partial research and budget stops

Deep research can stop with page_limit, links_exhausted, time_limit, unconfirmed_page, budget_exhausted or billing_review. A null stopReason means no stopping reason has been recorded yet. Inspect research.sources, including failed sources and warnings, before treating findings as complete.

research.webSearch, when available, reports status, sourcesFound and warning. The source count describes search discovery, not how many pages were successfully collected. Search failure normally falls back to website links, but INSUFFICIENT_BALANCE or BILLING_REVIEW stops further paid work instead.

A ready task can retain its starting-page content while task.error reports a budget or billing issue and task.analysis.status is failed. Check all three fields; do not interpret ready as a complete research report. Adding funds does not automatically resume stopped work.

Research beyond the starting page

Set analysis.depth to deep with format: markdown. maxPages is an integer from 2 to 30, defaults to 5, and includes the starting page. Company context is still optional. The starting page is collected first; public links from navigation and page content are ranked using your instruction, URL and link text. New links from collected pages can be followed up to three link levels. This is bounded link discovery, not autonomous browsing or exhaustive crawling.

For example, start from a careers page and ask for named customers. The collector can follow customer stories or case studies on the same origin before one combined analysis. It may also visit the homepage. Set analysis.webSearch: true to also discover independent sources through OpenAI web search, then collect relevant cited pages within the same page budget. The dashboard enables this by default; the API defaults to website-only discovery when omitted. It does not log in, bypass CAPTCHA, submit forms, or visit query-based pages, downloads and account pages. It may miss relevant links or information outside its limits.

Poll through researching and analyzing. research.sources shows selected URLs and collection outcomes; stopReason explains page_limit, links_exhausted, time_limit or unconfirmed_page. Each supported deep finding includes sourceUrl and a quote verified against that specific page. A logo, partner listing or integration is not automatically evidence of a current customer relationship.

waitFor applies only to the starting page. Linked pages use default readiness. Each extra page consumes scraping usage. Optional web search adds model and search-tool usage, with at most three search-tool calls. Private company context is not included in search; your question and a public starting-page excerpt are sent to the search model. A failed or interrupted search is not automatically retried; research continues using website links and reports a warning. Deep analysis sends up to the first 12,000 characters per collected source, at most 120,000 characters total, shared across all collected sources, with a 3,000-token output cap. Individual linked pages time out after five minutes; research stops after a 60-minute task window. Failed pages produce partial results, not invented details.

content remains the starting-page content; the analysis combines the successful sources. An uncertain linked-page submission stops further discovery and is not resubmitted automatically. Source content and analysis expire together 24 hours after the starting page is collected.

request.json / deep analysis
{
  "url": "https://YOUR_PUBLIC_HOST/career",
  "format": "markdown",
  "analysis": {
    "instruction": "Find named customers and public case studies. Cite evidence and distinguish customers from partners.",
    "depth": "deep",
    "maxPages": 30,
    "webSearch": true
  }
}

Read the analysis result

Continue polling while task.status is analyzing. When it is ready, inspect task.analysis.status. A ready analysis includes result.summary, result.findings, result.limitations and result.sourceUrl.

Each finding has field, value and evidence. evidence is an exact quote from the supplied page; values without a matching quote are left null. A matching quote is not a guarantee that the interpretation is correct. Review summaries and business-fit inferences before using them.

The response also includes model, usage.inputTokens, usage.outputTokens and inputTruncated. Usage describes tokens, not a customer invoice. History only includes analysis.status; fetch the individual task for the result.

Illustrative task.analysis result
{
  "status": "ready",
  "result": {
    "summary": "Northstar Packaging is based in Bristol.",
    "findings": [
      {
        "field": "location",
        "value": "Bristol",
        "evidence": "Based in Bristol, United Kingdom."
      }
    ],
    "limitations": [
      "Buying intent is not stated on the page."
    ],
    "sourceUrl": "https://northstar.example/about"
  },
  "model": "gpt-4.1-mini",
  "inputTruncated": false,
  "usage": {
    "inputTokens": 420,
    "outputTokens": 130
  }
}

Input, output and retention limits

Single-page analysis reads at most the first 40,000 characters of collected content and has a maximum output of 1,800 tokens. Deep analysis instead uses up to 12,000 characters per page and 3,000 output tokens. Truncation is reported with inputTruncated and a limitation. Prefer Markdown when raw HTML contains substantial markup or scripts.

Collected content and its analysis share contentExpiresAt, 24 hours after starting-page collection. Save both before expiry. New tasks debit confirmed provider usage at 1.5 times cost. Earlier pilot tasks remain free, and billing records survive content expiry.

Keep the content when analysis fails

If AI analysis fails, task.status becomes ready so you can retrieve the collected page. task.analysis.status is failed, with an error.code and error.message. A failed scrape skips analysis entirely.

ANALYSIS_UNAVAILABLE means analysis is disabled or not configured. ANALYSIS_RATE_LIMITED or ANALYSIS_PROVIDER_ERROR means the model service could not complete the request. ANALYSIS_INCOMPLETE means the output did not finish. ANALYSIS_REFUSED means the requested analysis was declined.

ANALYSIS_UNCONFIRMED means a timeout, interruption or unverified response. No automatic model retry occurs, because the original call may already have incurred cost. Replaying the same task returns its saved outcome. Contact support with the task ID before deliberately submitting another task.

A new analysis request returns HTTP 503 before collecting a page if analysis is disabled. Remove analysis for a content-only task, using a new task key for the changed request.

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