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

# Request Behavior

This page explains how RouteMesh handles your RPC requests: **allowed domains** for API keys, **cooldowns and rate limiting**, **batch requests**, and **eth\_getLogs limits**.

## eth\_getLogs limits

RouteMesh enforces a maximum block span of **10,000 blocks** per `eth_getLogs` request when both `fromBlock` and `toBlock` are fixed hex values. Dynamic tags (`latest`, `safe`, `finalized`, `pending`) are not pre-validated against this limit.

Both fixed endpoints count **inclusively**. The number of blocks is `toBlock - fromBlock + 1`.
For a 10,000-block span, `fromBlock = 0x64` (100) and `toBlock = 0x2773` (10,099)
reach the boundary; `toBlock = 0x2774` (10,100) spans 10,001 blocks and exceeds it.
A single block uses the same `fromBlock` and `toBlock`. Reversed bounds are rejected.
These examples establish the router's configured 10,000-block ceiling, not availability
or permission to use that span on every route. Apply a smaller chain/access-tier hint
when one is returned.

When a request exceeds a limit, the router returns a normalized JSON-RPC error with an actionable hint in `error.message`. See [RPC Error Codes](https://routeme.sh/docs/intro/rpc-error-codes.md#error-messages-and-hints) for the full code table.

| Situation | Code | What to do |
| :- | :- | :- |
| Block span exceeds 10,000 blocks | **-32602** (`block range too large`) | Split the query into smaller `fromBlock`/`toBlock` windows. Use the `; try a block range of at most N blocks` hint when present. |
| Span is within limits but too many logs match | **-32005** (`query exceeds max results`) | Narrow the block range using the hint, or tighten filters (`address`, `topics`). Common for unfiltered or high-volume contracts. |

**Retry pattern:** On `-32005`, halve the block span and retry until the query succeeds, then widen gradually if needed. On `-32602`, stay at or below the hinted maximum span.

**The hint's `N` is your current limit, not always the 10,000 cap.** The `; try a block range of at most N blocks` suffix reports the largest span RouteMesh can currently route for that chain and access tier. This can be smaller than 10,000 and changes over time — different chains and access tiers can have different limits, and the value moves as providers and their limits change. When you see the hint, use its `N` as the maximum for that chain.

## Allowed domains

API keys can be restricted to specific origins (domains). When an key has **allowed domains** set, the router checks the request’s `Origin` (or Referer) header against that list. If the request comes from a domain that is not allowed, the router returns **403 Forbidden** and does not forward the request.

* **No allowed domains** (empty list): the key is allowed from any origin. Use this for server-side or mobile apps where no browser origin is sent.
* **With allowed domains**: only requests whose origin matches one of the listed hostnames are accepted. Use this for web apps to limit key usage to your front-end domain(s).

Allowed domains are configured when you create or update an API key in the dashboard. The comparison is against the request’s origin hostname (e.g. `app.example.com`), without path or scheme. This reduces the risk of a key being used from an unauthorized site.

## Cooldowns and rate limiting

When an upstream node returns a rate-limit (HTTP 429) or service-unavailable (503) response, RouteMesh puts that **pathway** (node + method) on a short **cooldown**. During cooldown, the router will not send new requests to that pathway, so you avoid hammering a node that is already overloaded.

* Cooldowns are **per pathway** (node and method), not global. Other nodes or methods are still used.
* If **all** pathways that can serve your route are on cooldown, the router returns HTTP **429 Too Many Requests** and a JSON-RPC error with code **-32005 (Limit exceeded)** and `error.data.reason` = `capacity_cooldown`.
* When you get this cooldown error, **retry after a short backoff** (e.g. a few seconds). Cooldowns are temporary; once they expire, the same request can succeed.

> [!NOTE]
>
> The cooldown error uses **-32005**, not **-32003**. EIP-1474 assigns -32003 to "Transaction rejected", and some clients (e.g. viem's `fallback` transport) treat that code as terminal — they stop and do not try the next provider. Using -32005 lets standard clients fall back or retry on their own. Distinguish a cooldown (HTTP 429, `error.data.reason` = `capacity_cooldown`) from an `eth_getLogs` query-density error, which also uses -32005 but returns HTTP 400.

Our aggregate capacity depends on the available providers for your chain and method. For workload planning and a capacity assessment, see [Capacity and rate limits](https://routeme.sh/docs/intro/capacity-and-rate-limits.md). If you consistently hit cooldowns on a chain, reach out so we can help investigate.

For Ethereum RPC failover examples and client retry guidance, see [Failover setup](https://routeme.sh/docs/intro/ethereum-rpc-failover.md).

## Batch requests

You can send multiple JSON-RPC requests in a single HTTP request by posting a **JSON array** of request objects instead of a single object. The response is a JSON array of responses in the **same order** as the requests.

* **Order**: Response index `i` corresponds to request index `i`. Use the `id` field in each request to match responses to requests if needed.
* **Partial failures**: Each batch item is processed independently. Some entries may have `result` and others `error`. The HTTP status of the batch is derived from the set of per-request statuses (e.g. 200 if any succeeded, 424 if all failed dependency, 429 if all rate limited).
* **Empty batch**: Sending an empty array `[]` is invalid and returns **400** with JSON-RPC code **-32600 (Invalid request)**.

Batch requests are a good way to reduce round-trips when you need multiple RPC calls (e.g. several `eth_call` or `eth_getBlockByNumber` in one HTTP request).

For request debugging (including `X-Batch-Id` and the Dashboard Logs page), see [Debugging](https://routeme.sh/docs/intro/debugging.md).


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