scrape

Submit a scrape request (auto or manual proxy mode; async, or wait for the result directly)

post/v1/scrape

Request

  • Base URL: https://barchin.net/api
  • URL: https://barchin.net/api/v1/scrape
  • Auth: HTTP bearer

Query parameters

waitinteger

0 (default) = async, returns request_id. N > 0 = wait up to N seconds for the result. ۰ (پیش‌فرض) = async و برگرداندن request_id. عدد > ۰ = تا این تعداد ثانیه منتظر نتیجه بمان و همان را مستقیم برگردان (سقف سرور: SYNC_MAX_WAIT_SECONDS)؛ اگر در این مدت آماده نشد، ۲۰۲ با request_id برمی‌گردد — درخواست ادامه دارد و شکست نخورده است. برای اجراهای طولانی (مثلاً آنبلاکر) async بفرستید و status_url را poll کنید.

format'html' | 'markdown' | 'text'

Result format. markdown/text are derived from the stored HTML at read time at no extra cost.

max_charsinteger nullable

Truncate markdown/text to this many characters; sets truncated=true.

Request body

urlstring required
js_enabledboolean

Render the full page with a browser. Default: on. Send false for pages that don't need JavaScript to pay 5 fewer credits.

mode'auto' | 'manual'
proxy'datacenter' | 'residential' | 'unblocker'

The public name of a tier; this is what the API accepts and returns.

countrystring nullable

Two-letter country code the exit IP should be from (e.g. ir, de, us). Default: worldwide. Sites that only serve their own country's users reject foreign IPs, and rotating proxies does not help there since the next IP is foreign too. Has no effect on the datacenter pool (a single fixed IP, wherever it was bought).

wait_forstring nullable

CSS selector. Only with js_enabled=true: after the page loads, wait for this element to appear in the DOM (up to 20s) before reading the HTML. For pages that fetch price/content in a separate request after the initial render. The request does not fail if the element never appears — the HTML at that point is returned as-is.

wait_msinteger

Milliseconds (up to 15000). Only with js_enabled=true: wait this long after the page loads (and after wait_for, if given) before reading the HTML. delay is also accepted as this field's name.

freshboolean

true = ignore any cached response for this URL and fetch the page again. A request with wait_for or wait_ms is always fetched fresh. no_cache is also accepted.

accept_binaryboolean

Accept a non-HTML body — a PDF, an image, an archive — instead of failing with unsupported_content_type. The file is fetched over plain HTTP through the same proxy ladder (a 403/429 escalates to a residential IP exactly as a page would), kept for the usual result retention and returned in result as content_base64 (up to 15 MB) plus a bearer-protected download_url; html/markdown/text are null and size_bytes is the file size. Whatever the server sends is stored as-is, an HTML body included. Requires js_enabled=false — a file is never rendered, so the render surcharge never applies. پذیرش پاسخ غیر-HTML (PDF، تصویر، آرشیو…): فایل از همان نردبان پروکسی گرفته می‌شود و در result به‌صورت content_base64 (تا 15 مگابایت) و download_url برمی‌گردد. فقط با js_enabled=false.

Example request

{
  "url": "https://example.com/products?page=2",
  "country": "ir",
  "wait_for": ".product-price"
}

Response

نتیجه‌ی آماده (حالت wait)

request_idstring uuid required
urlstring required
js_enabledboolean required
wait_forstring nullable
wait_msinteger
freshboolean
accept_binaryboolean
mode'auto' | 'manual' required
countrystring nullable
proxy_requested'datacenter' | 'residential' | 'unblocker' required

The public name of a tier; this is what the API accepts and returns.

proxy_used'datacenter' | 'residential' | 'unblocker' required

The public name of a tier; this is what the API accepts and returns.

status'queued' | 'processing' | 'done' | 'failed' required
credits_heldinteger required
credits_chargedinteger nullable required
credits_releasedinteger required
source'api' | 'dashboard' required
api_key_idstring uuid nullable required
created_atstring date-time required
started_atstring date-time nullable
completed_atstring date-time nullable required
queued_msinteger nullable
duration_msinteger nullable
total_msinteger nullable
result_expiredboolean

Changes

No recorded changes to this operation across all 1 revision of this API.