Getting started
Rate limits
Plans and per-key limits will be published when accounts open. Until then, beta keys share a fair-use limit.
During the private beta
- Keep to a few requests a second per key. Bulk jobs are welcome; run them one request at a time.
- PatentsView-compatible routes return up to 1,000 rows per request (
o.size), so large exports need fewer calls. - We'll email you before limiting a key that sends much more than that.
The Try it panels in these docs use a shared demo key, limited to 10 requests a minute per visitor.
Retrying
Every route only reads, so retrying is always safe. Retry 429, 502, 503 and 504 after a short wait, doubling it each time. Don't retry 400, 401 or 404: the same request will fail the same way.
import os, time, requests
RETRY = {429, 502, 503, 504}
def search(params, attempts=4):
for attempt in range(attempts):
resp = requests.get(
"https://api.patentgrep.com/v1/search",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
params=params,
)
if resp.status_code not in RETRY:
resp.raise_for_status()
return resp.json()
time.sleep(0.5 * 2**attempt)
resp.raise_for_status()