Skip to main content
For high traffic, don’t point every request at Pinterest directly. Wrap reads in a Gateway, which adds four things on top of a plain client:
  • SessionPool: N sessions with round-robin, least-loaded checkout and automatic cooldown when a slot is rate-limited or blocked.
  • CacheStore: repeat reads are served from cache instead of being re-fetched.
  • GlobalRateLimiter: caps per-host throughput across every slot.
  • Request coalescing: N parallel identical reads trigger exactly one upstream fetch.

Create a gateway

Seed the session pool

Seed the pool with your own accounts.
Never seed the pool with end-user cookies.

Share state across processes

The in-memory cache and limiter are per-process. To share state across processes or regions, implement the CacheStore interface with Redis and inject it with createGateway({ cache }).