Skip to main content

    PubChem rate limits

    Pace PubChem at 3-5 requests per second, 1-2 for structure searches, and back off from 1-2 seconds to 30 on a 429 while honouring Retry-After.

    PubChem rate limits

    Stay within PubChem’s throttling while keeping results responsive. Inside chat, Ivy paces PubChem requests for you; the guidance below is for scripts that call PubChem directly, on your own machine or in the chat's code workspace.

    • Page requests: 3–5 requests per second per client is typically safe.
    • Structure searches: treat as heavier; pace at 1–2 requests per second.
    • Large exports: split into pages and download sequentially.

    Backoff strategy

    • Use exponential backoff starting at 1–2 seconds, doubling to a max of ~30 seconds.
    • On HTTP 429, respect Retry-After if provided; otherwise wait at least 5 seconds.
    • Avoid concurrent exports for the same query; reuse cached results instead.

    Caching behavior

    • The platform may cache recent queries; cached responses return immediately with a timestamp.
    • Re-run the same query only when you need fresher data; otherwise reuse the cached export.
    • Log whether a response came from cache to interpret latency.

    Monitoring tips

    • Track error rates and 429s per client to tune pacing.
    • Record query type (text/identifier/structure), filters, and page size to correlate with throttling.
    • Keep request IDs in logs so support can trace failures.

    If you’re repeatedly throttled

    • Lower concurrency and increase delay between requests.
    • Narrow queries (add filters) to reduce result size.
    • Prefer identifier or InChIKey searches over broad synonym queries for heavy workloads.

    Was this page helpful?

    On this page

    On this page

    Loading...