Mezcal ExplorerMezcalDocs
QuickstartBuildAgentsReference
Open explorer
Documentation homeQuickstartConceptsMonitor 10 Wallets
BuildLaunch MatrixAPIAdvanced UtilitiesAgent HTTP quickstartRate limitsRoute examplesSelf-serve account routesSDKTypeScript SDK

Live reference

Interactive API referenceReference hub
AgentsAgent CLIMCP Quickstart
Reference Hub
Docs/API/Rate limits

Rate limits

Understand Starkscan route-class budgets, headers, and the correct retry behavior for external API keys.

API referenceReferenceQuickstartTypeScript SDK

In this guide

Route classesHeaders to readRetry rulesExample `429`Operational noteBest practices for agents
Loading documentation content…
PreviousAgent HTTP quickstartGive an agent a bounded Starkscan HTTP contract without making it guess base paths, auth, or route scope.NextRoute examplesExact examples for Starkscan routes that agents most often misread: block reads, search, trace, contract reads, previews, and holdings.

On this page

Route classesHeaders to readRetry rulesExample `429`Operational noteBest practices for agents
Mezcal ExplorerMezcalDocumentation

One product surface across the explorer, HTTP API, CLI, SDK, and MCP transport. The docs should guide you into the right path instead of behaving like a separate app.

Open explorerAPI referenceBack to top

Rate limits

Starkscan rate-limits external API keys by route class.

Treat rate limits as part of the HTTP contract, not as a hidden operational detail.

Route classes

Current external keys use two public route classes:

ClassTypical useExample routes
lightcheap health-style readsGET /v1/{chain}/status
heavyhigher-cost entity reads, traces, search, contract reads, and batch helpersGET /v1/{chain}/tx/{tx_hash}/trace, GET /v1/{chain}/search, GET /v1/{chain}/contract/{address}/read, POST /v1/{chain}/tx/previews

The exact numeric budget is deployment-controlled. Read the headers instead of hard-coding assumptions into clients.

Headers to read

Starkscan can emit these budget headers on budgeted responses:

  • x-ratelimit-limit
  • x-ratelimit-remaining
  • x-ratelimit-policy
  • X-Mezcal-Route-Class

On 429 Too Many Requests, Starkscan also emits:

  • Retry-After

Example response headers:

x-ratelimit-limit: 30
x-ratelimit-remaining: 0
x-ratelimit-policy: heavy;w=60
X-Mezcal-Route-Class: heavy
retry-after: 12

Retry rules

  • On 429 Too Many Requests, stop and honor Retry-After.
  • Do not retry immediately in a tight loop.
  • Keep concurrency bounded even when x-ratelimit-remaining still looks healthy.
  • Prefer the smallest route set that answers the task.

Example 429

curl -i \
  -H "X-Starkscan-Api-Key: $MEZCAL_API_KEY" \
  "$MEZCAL_BASE_URL/v1/$MEZCAL_CHAIN/contract/<address>/read?selector=<selector>"

Representative response:

HTTP/1.1 429 Too Many Requests
retry-after: 12
x-ratelimit-limit: 30
x-ratelimit-remaining: 0
x-ratelimit-policy: heavy;w=60
X-Mezcal-Route-Class: heavy
content-type: application/json; charset=utf-8

{"code":"rate_limited","message":"Rate limit exceeded; retry shortly","docSlug":"api/rate-limits","requestId":"mzk-..."}

Operational note

Current public-read rate limiting is process-local fixed-window state:

  • counters reset on process restart
  • each replica enforces its own independent window budget
  • boundary-adjacent bursts can briefly approach roughly double the minute budget

Do not build client correctness on an assumption that every host behaves like one perfectly global distributed limiter.

Best practices for agents

  • Use Agent HTTP quickstart as the bounded starter contract.
  • Back off by route class. A heavy 429 should not force an agent to stop cheap light status checks.
  • Log X-Request-Id on every failure.
  • Include rate-limit headers in issue reports when present.
  • Prefer cursor-based incremental reads over repeated full rescans.