Understanding api caching / usage

i want to understand api limits and graphql queries wrt to caching : my understanding is that the api caches at the edge, so similar queries made without data updates will not count against api usage. however, iirc this was true with the rest api, i can’t imagine how the etag would be set for graphsql queries and my experience is leading me to think that each, and every call to the graphql server counts against api limits… is this true? any clarification appreciated.

hello @dojo4

currently every call both to our REST and GraphQL endpoints count against the API call limit.

Also the CMS UI is using the REST API (as you can see from the browser inspector) and we count those as well.

So caching is not considered in any case as also for cached requests we need to do some computation on the edge.

Hello @ mat_jack1, so small question this means the implementation of a PWA that request caching the response from dato is not possible at the moment?

Hey @maria.arce I’m not getting your question, if you want to cache the requests on your PWA you surely can

1 Like

As an alternative solution, if you’re worried about reaching API limits due to too many reads by your users, you can cache the read endpoint (the graphQL content delivery API query) behind a serverless function like a caching Cloudflare Worker. That way you can also customize the caching TTL per query.

It takes just a few minutes to set that up and it gets you 1 million free requests/mo. Beyond that it’s $5/10 million requests, which is I think 10x cheaper than DatoCMS API queries?

1 Like