Run several inputs of one actor in one call — each an ordinary run with its own id and bill (async, or wait for all)
Submit several inputs of one actor at once and get the runs back keyed by your own labels. Built for callers that ask the same actor a handful of related questions per unit of work — a datasheet lookup that fires three to five google-search queries per product — and want one round trip instead of five.
Nothing about a run changes. Every item becomes an ordinary run: its own run_id, its own hold, its own bill, its own place in the queue, visible under GET /v1/actors/{slug}/runs like any other. The batch is a convenience over the submission and, with wait, over the waiting.
All-or-nothing up front. Every item is validated by the actor before any of them is submitted; one bad item fails the whole batch with 422 (details.key names it) and nothing is reserved. The sum of the holds is checked against your balance the same way — 402 insufficient_credits with details.required/details.balance, nothing submitted — so a batch you cannot afford never starts half-way. Items are then submitted in order. Should one still fail after earlier ones were accepted (a credit race with another request of yours, a queue outage), the earlier runs are already executing and are returned as usual; that item lands under errors with nothing reserved for it, and is the only thing to resubmit.
Waiting. With wait (query or body), the call blocks until every submitted run has finished or the budget runs out: 200 when all finished (finished == submitted, pending empty, each result carrying its dataset), else 202 with Retry-After and the unfinished keys in pending. A 202 is not a failure — those runs keep going; poll them by run_id, do not resubmit, a resubmit is a second charge. Without wait the answer is an immediate 202 with every key pending.
mode, proxy and country apply to every item alike; split the batch if the items need different ones.
چند ورودی از یک اکتور را یکجا بفرستید و اجراها را با برچسبهای خودتان تحویل بگیرید. هیچچیز اجرا عوض نمیشود: هر مورد یک اجرای عادی است با run_id، رزرو و صورتحساب خودش. همهی موارد پیش از ارسال اعتبارسنجی میشوند و مجموع رزرو با موجودی سنجیده میشود؛ یک مورد نامعتبر یا موجودی ناکافی کل دسته را بدون رزرو هیچ کردیتی رد میکند. با wait تا تمام شدن همهی اجراها منتظر میمانیم: ۲۰۰ اگر همه تمام شدند، وگرنه ۲۰۲ با کلیدهای تمامنشده در pending — آن اجراها ادامه دارند؛ با run_id دنبالشان کنید و دوباره نفرستید.
Request
- Base URL: https://barchin.net/api
- URL: https://barchin.net/api/v1/actors/{slug}/batch
- Auth: HTTP bearer
Path parameters
Query parameters
0 = async, every key comes back pending. >0 = wait up to this many seconds for ALL the runs to finish (server ceiling: SYNC_MAX_WAIT_SECONDS); 200 when they all did, else 202 with the unfinished keys in pending — those runs continue; poll them. Also accepted in the body as wait; the query parameter wins when both are given. ۰ = async، همهی کلیدها در pending برمیگردند؛ >۰ = تا این ثانیه منتظر تمام شدن همهی اجراها بمان (سقف سرور: SYNC_MAX_WAIT_SECONDS). اگر همه تمام شدند ۲۰۰، وگرنه ۲۰۲ با کلیدهای تمامنشده در pending — آن اجراها ادامه دارند؛ دنبالشان کنید. در بدنه هم بهصورت wait پذیرفته میشود؛ اگر هر دو باشند پارامتر کوئری برنده است.
Applied to every item. auto (default): start from the cheapest proxy and escalate only if needed; manual: use exactly the pool named in proxy. برای همهی موارد اعمال میشود. auto (پیشفرض): از ارزانترین پروکسی ممکن شروع و در صورت نیاز ارتقا میدهیم. manual: فقط نوعی که در proxy مشخص میکنید.
The public name of a tier; this is what the API accepts and returns.
Applied to every item. Proxy pool: datacenter | residential | unblocker. Only meaningful with mode=manual; defaults to residential if omitted. Cannot exceed this actor's max_tier. برای همهی موارد اعمال میشود. نوع پروکسی: datacenter | residential | unblocker. فقط در mode=manual معنا دارد؛ اگر نفرستید residential استفاده میشود. بالاتر از max_tier همین اکتور مجاز نیست.
Applied to every item. Two-letter country code the exit IP should be from (e.g. ir). Default: worldwide. An actor with a fixed exit country ignores it (with a warning on each run). برای همهی موارد اعمال میشود. کد دو حرفی کشوری که IP خروجی باید از آن باشد (مثل ir). پیشفرض: جهانی. اکتوری که کشور خروجی ثابت دارد آن را نادیده میگیرد (با warning روی هر اجرا).
Request body
Example request
{
"queries": [
{
"url": "https://torob.com/p/16080a39-171a-4b75-8b76-fcd95e26983e/",
"key": "q1"
}
]
}Response
همهی اجراها تمام شدند (حالت wait)
Changes
No recorded changes to this operation across all 1 revision of this API.