> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapebadger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Concurrency

> How many requests your account can run at the same time, what counts toward that limit, and how to handle a 429 when you reach it.

Every ScrapeBadger account has a **max concurrency**: how many requests it can have in flight at the same time. There is no per-minute or per-day request limit. When a request finishes, its slot is free for the next one at once.

## How it works

> [card] One number per account
>
> Every API key of your account shares it, and so do your team members' keys. A team's keys use the team owner's account.

> [card] Requests in flight
>
> A request takes a slot when it starts and frees it when it finishes. Fast calls get through many times per second.

> [card] Never queued
>
> A request over the limit gets `429` straight away. It doesn't run, isn't billed and isn't queued. Retry it after 1 second.

How many calls you can finish per second is your max concurrency divided by how long each call takes. With a max concurrency of 25 and calls that take 2 s each, you complete about 12 calls per second, or about 750 per minute. AI asks take 15–40 s each, so the same 25 slots complete fewer of them.

## Max concurrency by plan

| Plan | Max concurrency |
| - | - |
| Free (sign-up credits, nothing bought yet) | 1 |
| Pay-as-you-go | 5 |
| Starter | 5 |
| Growth | 25 |
| Pro | 50 |
| Scale | 150 |
| Volume | 300 |
| Max | 800 |
| Custom and enterprise plans | Custom |

> [!NOTE]
>
> These are the starting values. The current value of each plan is on the [pricing page](https://scrapebadger.com/pricing). Your own account's value is `max_concurrency` in [`GET /v1/account/me`](#check-your-account) and the `X-Concurrency-Limit` header.

* Your first credit purchase moves a Free account to the Pay-as-you-go value.
* A subscription sets the plan's value. If you cancel it, the account goes back to the Pay-as-you-go value when the subscription ends.
* A change applies to your next request.

## What counts

A request holds one slot for as long as it runs, whether it succeeds or fails.

| Counts | Doesn't count |
| - | - |
| Every `/v1` call while it runs, including free ones: `/v1/account/me`, `/v1/quote` and the Twitter stream management routes | Polling an async call: `GET /v1/requests/{request_id}` |
| An [async call](https://docs.scrapebadger.com/long-running-requests.md) (`Prefer: respond-async`, `async=true` or a callback URL), from the submit until the call finishes, not just until the `202` | Polling a web unblock search: `GET /v1/web/unblock/{job_id}` |
| Each item of a [batch](https://docs.scrapebadger.com/long-running-requests.md#submit-a-batch), from when it is accepted until it finishes | The `POST /v1/batch` submit itself (only its items count) |
| Calls your AI agent makes through the [MCP server](https://docs.scrapebadger.com/mcp/overview.md) with your key | The live [Twitter stream WebSocket](https://docs.scrapebadger.com/twitter-streams/websocket.md) connection |

Unclaimed agent [trial keys](https://docs.scrapebadger.com/ai-agents.md#trial-keys-no-account) don't use an account's max concurrency. They run one call at a time: a second call while the first is still running gets `429` with `"error": "trial_concurrency"`.

## Response headers

Every response to a request that counts carries these headers:

| Header | Description | Example |
| - | - | - |
| `X-Concurrency-Limit` | Your account's max concurrency | `25` |
| `X-Concurrency-Remaining` | How many more requests you can start right now, with this one running | `24` |
| `Retry-After` | On a `429` only: seconds to wait before you retry. Always `1`. | `1` |

## Over the limit: 429

When all of your account's slots are in use, the next request is refused at once with `429 Too Many Requests`. It doesn't run and isn't billed. Nothing is queued on our side, so retry it yourself as soon as one of your running requests finishes.

```json 429 concurrency_limit_exceeded theme={null}
{
  "error": "concurrency_limit_exceeded",
  "detail": "Too many concurrent requests: this account allows 5 at a time and 5 are already running. Retry as soon as one finishes, or upgrade your plan for more: https://scrapebadger.com/pricing",
  "max_concurrency": 5,
  "concurrent_requests": 5
}
```

The response also carries `Retry-After: 1`, `X-Concurrency-Limit: 5` and `X-Concurrency-Remaining: 0`.

| Field | Description |
| - | - |
| `error` | Always `concurrency_limit_exceeded` for this response |
| `detail` | A human-readable explanation |
| `max_concurrency` | Your account's max concurrency |
| `concurrent_requests` | How many of your requests were running when this one arrived |

> [!TIP]
>
> Other `429` responses use a different `error`, for example `trial_concurrency` on a trial key or a target site's own limit. Check `error` before you treat a `429` as your max concurrency.

## Check your account

`GET /v1/account/me` is free. It returns your max concurrency and how many of your requests are running right now, not counting this call:

```bash theme={null}
curl -s https://scrapebadger.com/v1/account/me \
  -H "x-api-key: $SCRAPEBADGER_API_KEY"
```

```json theme={null}
{
  "credits_balance": 99171,
  "subscription_credits_balance": 0,
  "total_credits_balance": 99171,
  "max_concurrency": 5,
  "concurrent_requests": 2,
  "subscription": null
}
```

The call itself counts while it runs. Read `max_concurrency` once when your program starts, and limit parallel calls on your side. Don't poll this endpoint to decide when to send the next request.

## Stay under the limit

Run at most `max_concurrency` requests at a time on your side, and retry a `429` after `Retry-After`. If several workers or servers share one account, split the number between them: they all draw on the same slots.

```python Python (asyncio) theme={null}
import asyncio
import os

import httpx

BASE = "https://scrapebadger.com"
HEADERS = {"x-api-key": os.environ["SCRAPEBADGER_API_KEY"]}


async def call(client: httpx.AsyncClient, slots: asyncio.Semaphore, path: str, params: dict) -> dict:
    async with slots:  # at most max_concurrency calls in flight
        while True:
            response = await client.get(BASE + path, params=params)
            if response.status_code == 429 and response.json().get("error") == "concurrency_limit_exceeded":
                await asyncio.sleep(float(response.headers.get("Retry-After", "1")))
                continue
            response.raise_for_status()
            return response.json()


async def main(queries: list[str]) -> list[dict]:
    async with httpx.AsyncClient(headers=HEADERS, timeout=130) as client:
        me = (await client.get(BASE + "/v1/account/me")).json()
        slots = asyncio.Semaphore(me["max_concurrency"])
        return await asyncio.gather(
            *(call(client, slots, "/v1/google/search", {"q": q}) for q in queries)
        )


results = asyncio.run(main(["web scraping api", "serp api", "proxy api"]))
```

```javascript JavaScript (promise pool) theme={null}
const BASE = "https://scrapebadger.com";
const headers = { "x-api-key": process.env.SCRAPEBADGER_API_KEY };
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function call(path) {
  for (;;) {
    const response = await fetch(BASE + path, { headers });
    if (response.status === 429) {
      const body = await response.json();
      if (body.error !== "concurrency_limit_exceeded") throw new Error(body.detail);
      await sleep(Number(response.headers.get("Retry-After") ?? 1) * 1000);
      continue;
    }
    if (!response.ok) throw new Error(`HTTP ${response.status}`);
    return response.json();
  }
}

// Run fn over items with at most `limit` calls in flight.
async function pool(items, limit, fn) {
  const results = new Array(items.length);
  let next = 0;
  const worker = async () => {
    while (next < items.length) {
      const i = next++;
      results[i] = await fn(items[i]);
    }
  };
  await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
  return results;
}

const me = await (await fetch(`${BASE}/v1/account/me`, { headers })).json();
const queries = ["web scraping api", "serp api", "proxy api"];
const results = await pool(queries, me.max_concurrency, (q) =>
  call(`/v1/google/search?q=${encodeURIComponent(q)}`),
);
```

```javascript JavaScript (p-limit) theme={null}
import pLimit from "p-limit";

// BASE, headers and call() as in the promise pool example
const me = await (await fetch(`${BASE}/v1/account/me`, { headers })).json();
const limit = pLimit(me.max_concurrency);

const queries = ["web scraping api", "serp api", "proxy api"];
const results = await Promise.all(
  queries.map((q) => limit(() => call(`/v1/google/search?q=${encodeURIComponent(q)}`))),
);
```

### With the SDKs

From version 0.84.0, the Python and Node SDKs raise `RateLimitError` for a `429`. It carries your max concurrency, how many requests were running and how many seconds to wait. Both SDKs first retry the call themselves, waiting at least `Retry-After`, and raise `RateLimitError` only when their retries run out (`max_retries` / `maxRetries`, 10 by default).

| Python | Node | Description |
| - | - | - |
| `max_concurrency` | `maxConcurrency` | Your account's max concurrency |
| `concurrent_requests` | `concurrentRequests` | How many of your requests were running when this one arrived |
| `retry_after` | `retryAfter` | Seconds to wait before you retry, from `Retry-After` |

```python Python SDK theme={null}
import asyncio

from scrapebadger import RateLimitError, ScrapeBadger


async def search(client: ScrapeBadger, slots: asyncio.Semaphore, query: str):
    async with slots:
        try:
            return await client.google.search.search(query)  # retries a 429 itself
        except RateLimitError as e:
            # Raised once the SDK's own retries run out
            print(f"{e.concurrent_requests}/{e.max_concurrency} running, retry in {e.retry_after}s")
            raise


async def main(queries: list[str]):
    async with ScrapeBadger(api_key="YOUR_API_KEY") as client:
        me = await client.account.get_account_info()
        slots = asyncio.Semaphore(me["max_concurrency"])
        return await asyncio.gather(*(search(client, slots, q) for q in queries))


results = asyncio.run(main(["web scraping api", "serp api", "proxy api"]))
```

```typescript Node SDK theme={null}
import pLimit from "p-limit";
import { RateLimitError, ScrapeBadger } from "scrapebadger";

const client = new ScrapeBadger({ apiKey: process.env.SCRAPEBADGER_API_KEY });
const me = await client.account.getAccountInfo();
const limit = pLimit(Number(me.max_concurrency));

async function search(q: string) {
  try {
    return await client.google.search.search({ q }); // retries a 429 itself
  } catch (error) {
    if (error instanceof RateLimitError) {
      // Thrown once the SDK's own retries run out
      console.log(`${error.concurrentRequests}/${error.maxConcurrency} running, retry in ${error.retryAfter}s`);
    }
    throw error;
  }
}

const queries = ["web scraping api", "serp api", "proxy api"];
const results = await Promise.all(queries.map((q) => limit(() => search(q))));
```

## Async calls and batches

* **An async call keeps its slot until it finishes.** The `202` comes back at once, but the call still runs. If your max concurrency is 25 and 25 async calls are still running, the next submit gets `429`.
* **Polling is free and doesn't count.** Poll `GET /v1/requests/{request_id}` as often as its `retry_after_seconds` suggests, or use a callback URL. Webhook deliveries to your server don't count either.
* **Each batch item takes its own slot.** It holds the slot from when it is accepted until it finishes. Items over your max concurrency come back with `"accepted": false` and `"status": 429`. They aren't billed, and you can resubmit just those items once earlier ones finish.
* **Size batches to your free slots.** A batch of 100 items on an account with 25 free slots starts 25 and refuses 75. Check `X-Concurrency-Remaining` on a recent response, or `max_concurrency` minus `concurrent_requests` from `/v1/account/me`, before you submit.

See [Async requests and webhooks](https://docs.scrapebadger.com/long-running-requests.md) for the details of each.

## Best practices

> [card] Limit parallel calls on your side
>
> Use a semaphore, a worker pool or `p-limit` sized to your max concurrency. Firing everything at once only turns the extra calls into `429`s.

> [card] Retry 429 after Retry-After
>
> A refused request wasn't run or billed, so it is safe to send again. Wait the `Retry-After` seconds (1) and retry.

> [card] Use async for long calls
>
> AI asks and rendered pages take tens of seconds. Run them [asynchronously](https://docs.scrapebadger.com/long-running-requests.md) so you don't hold a connection open for each one. They still count until they finish.

> [card] Store results on your side
>
> ScrapeBadger doesn't cache responses, so an identical repeat call is billed again and takes a slot again. Keep results on your side where appropriate.

> [!WARNING]
>
> Max concurrency is per account, so extra API keys don't add capacity. Opening several accounts to get around the limit may get them restricted. If you need more, upgrade your plan or contact sales.

## FAQ

> [accordion] Is there still a requests-per-minute limit?
>
> No. Your account has a max concurrency only. How many requests you can make per minute depends on how quickly your calls finish.

> [accordion] How is max concurrency applied?
>
> Per account. All of your API keys, and the keys of your team's members, share the same slots. One busy key can use every slot, so limit each application on your side if they must not block each other.

> [accordion] What happens when I go over it?
>
> The request gets `429` with `"error": "concurrency_limit_exceeded"` and `Retry-After: 1`. It isn't run, queued or billed. Retry it as soon as one of your running requests finishes.

> [accordion] Which calls count?
>
> Every `/v1` call while it runs, including the free ones: `/v1/quote` (an agent's `quote_call`) and `/v1/account/me` (`get_account_info`) take a slot like a scrape. On the Free plan's one request at a time, an agent that quotes or checks its balance while another call runs gets a `429`, so make those calls one after another. Polling an async call (`/v1/requests/{request_id}`) doesn't count. See [What counts](#what-counts).

> [accordion] Do failed requests count?
>
> Yes, while they run. A request refused with `429` for being over the limit never takes a slot.

> [accordion] Can different API keys have different limits?
>
> No. Max concurrency is one number for the whole account. To give an application a smaller share, limit it on your side.

> [accordion] Do async calls free their slot when I get the 202?
>
> No. An async call and each batch item hold a slot until the call finishes. Only polling for the result is free of the limit.

> [accordion] How do I get a higher max concurrency?
>
> Upgrade your plan on the [pricing page](https://scrapebadger.com/pricing). For more than the largest plan includes, contact [sales@scrapebadger.com](mailto:sales@scrapebadger.com).

## Changes on 2026-11-29

Max concurrency replaced the per-minute rate limits and their tiers (Free, Basic, Pro, Enterprise). If your code read the old fields, update it:

| Before | Now |
| - | - |
| `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` headers | `X-Concurrency-Limit`, `X-Concurrency-Remaining` |
| `X-Api-Tier` header | Removed |
| `tier`, `rate_limit_per_minute` in `/v1/account/me` | `max_concurrency`, `concurrent_requests` |
| `429` body with `detail: "Rate limit exceeded"`, `limit`, `remaining`, `reset_at`, `tier` | `429` body with `error: "concurrency_limit_exceeded"`, `detail`, `max_concurrency`, `concurrent_requests` |
| SDK `RateLimitError` with `limit`, `remaining`, `reset_at`, `tier` | SDK 0.84.0 `RateLimitError` with `max_concurrency`, `concurrent_requests`, `retry_after` in seconds (Node: `maxConcurrency`, `concurrentRequests`, `retryAfter`) |

***

Need a higher max concurrency? Contact us at [sales@scrapebadger.com](mailto:sales@scrapebadger.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.