Bricks 2.1: API Query – Add Daily Request Limit (Hard Cap) Option

Hey Bricks Team,

Loving the new API Query in 2.1! Caching is confirmed to be shared across visitors via the WordPress Transients API – great foundation.

Feature request (focused): Please add a simple daily request limit (hard cap) for API Queries. Example: set 950 requests/day. Once the cap is reached, Bricks should stop sending new upstream requests and keep serving the last cached result (or a small fallback message).

Why it helps:

  • Guarantees we never exceed API quotas (and avoid unexpected costs), even with traffic spikes or bots.
  • Removes the need to “calculate cache duration” manually as a workaround.
  • Makes API Query production‑ready for many real‑world APIs (weather, maps, news, AI, etc.).

Thanks a lot for considering this while 2.1 is in beta — would be a fantastic quality‑of‑life addition!

2 Likes

Caching is already implemented.

But the daily request limit would be nice!

Thanks for pointing this out – good to know caching is already implemented!

@thomas : Could you confirm if this cache is shared across all visitors (server-side) or if it is applied per visitor/session?

My main concern is really about having a daily request limit option – so that once a set number of requests (e.g. 950/day) is reached, Bricks would stop sending new API calls and just serve the cached result (or a fallback message).

That would make it much easier to guarantee we never exceed an API quota, even if traffic suddenly spikes or bots are crawling the page.

It is indeed shared across all visitors. It utilises the WordPress Transient API (https://developer.wordpress.org/apis/transients/):

If you need to set a daily limit, you can work out the cache limit required with simple math, eg.

86400 (seconds in a day) / 950 (API limit) = 91 seconds - So, as long as you set the cache limit to 91+ seconds, you will never exceed the limit.

I’d add, though, that if you use the Query API in multiple places/pages on the site, this would allow exceeding the limit… So make sure to save and re-use the query as a ‘global’ query too, if that is the case:

Screenshot 2025-09-27 171155

1 Like

Thanks a lot for clarifying this – really helpful to know that the cache uses the WordPress Transient API and is shared across all visitors!

The calculation trick with 86400 / daily quota is smart – but it would still be great if Bricks could offer a simple UI option for this:

  • Set a max number of requests per day.
  • Automatically stop making new requests when that number is reached and keep showing the cached result.

This would make it super easy for non-technical users to guarantee they never exceed a quota, without manually working out cache durations.

Edit: I changed the original post to make my wish a bit clearer :slight_smile:

1 Like