Set or change a cap
- Open the API keys page (Settings > API keys).
- Open the menu of the key you want to limit and select Credit caps.
- Click Add a cap, choose the Window, enter the cap in credits, and click Add cap.
How caps work
A key can have any of these caps, alone or combined:- Keys are uncapped by default, including your main key.
- A key with several caps stops when it reaches any of them.
- All credits a key uses count toward its caps, overage included.
- Zenrows Browser (formerly, Scraping Browser) sessions count too, both their time and their data.
- Caps limit usage. They don’t reserve credits and don’t need to add up to your plan.
- Upgrades, downgrades and top-ups don’t change your caps.
When a key reaches its cap
The key stops working, and your other keys keep working. How the refusal looks depends on the product:- Fetch (formerly, Universal Scraper API) and Extract requests return HTTP
402with error code AUTH014. - Batch requests return HTTP
402with the codeapi_key_cap_reached. See Batch jobs. - New Zenrows Browser sessions are refused when they start, with error code AUTH014.
When the cap is checked
A cap is checked when something starts: each API request, and each Zenrows Browser session. If the key is still under its cap at that moment, the request or session goes ahead. What’s already running isn’t cut off:- A request in progress when the cap is reached completes.
- A Zenrows Browser session that’s already open keeps running until it ends. Everything it uses still counts toward the cap, and the next session started with that key is refused.
AUTH014 means one key reached its own cap. AUTH004 means your account has no credits left, which affects every key.
Batch jobs
Batch jobs use the caps of the key they run with. A capped key can’t start, add to, resume or rerun a job (402 api_key_cap_reached), a run that reaches a cap ends failed with failure_reason: api_key_cap_reached, and scheduled runs are checked when they start. See API key credit caps and Batch.
Tracking remaining credits
Responses from a key that has at least one cap include theX-Key-Credits-Remaining header: the lowest remaining credits across that key’s caps. Uncapped keys don’t get this header. If the usage of a cap can’t be read for a moment, the header leaves that cap out, and it isn’t sent at all when none of the key’s caps can be read.