Joint session with Vercel: How to build intelligent storefronts (May 15th) →

Reduce Sanity API requests and bandwidth usage for high-traffic Next.js blog

8 repliesLast updated: Nov 29, 2025

Hi, I have a next.js blog that receives a lot of traffic. Currently, my API Requests and Bandwidth usage are 30x more than what's included....with very expensive overage costs 😞 Is there anything I can do to reduce this usage? Any guides to refer to I'm not finding? I won't be able to afford this long term. Thank you
AI Update

I understand your concern - those overage costs can definitely add up quickly! The good news is there are several proven strategies to dramatically reduce your Sanity API requests and bandwidth usage. Let me break down the most effective approaches:

1. Implement Sanity's Live Content API

The most modern solution is Sanity's Live Content API, which is specifically designed to reduce API requests while keeping content fresh. It handles fetching, rendering, caching, and cache invalidation automatically - this is now the recommended approach for Next.js applications and can significantly reduce your API call volume since it intelligently manages caching for you without complex setup.

2. Optimize Your Next.js Caching Strategy

Since you're on Next.js with high traffic, proper caching is crucial:

Use Incremental Static Regeneration (ISR):

Example:

const posts = await sanityFetch({
  query: POSTS_QUERY,
  revalidate: 3600, // Revalidate every hour instead of on every request
})

For App Router:

3. Optimize Your GROQ Queries

This can have a huge impact on bandwidth:

Use projections to only fetch the fields you need:

// Bad - fetches everything
*[_type == "post"]

// Good - only fetches what you need
*[_type == "post"] {
  title,
  slug,
  publishedAt,
  "imageUrl": image.asset->url
}

Avoid deep reference resolution when not necessary - each -> traversal adds to your query cost and response size. Read more about query optimization techniques in Sanity's documentation.

4. Optimize Image Delivery

Images often account for the majority of bandwidth:

Example:

import imageUrlBuilder from '@sanity/image-url'

const builder = imageUrlBuilder(client)

// Request appropriately sized images
const imageUrl = builder
  .image(post.image)
  .width(800)
  .auto('format')
  .url()

5. Disable Unnecessary Prefetching

Next.js Link components prefetch by default, which generates API requests even for links users never click:

6. Check for Runaway Processes

Review your Sanity project's usage dashboard to identify:

7. Implement Smart Pagination

If you're loading large lists of posts, implement efficient pagination strategies rather than fetching all posts at once.

Quick Wins to Start With

The combination of proper caching strategy + query optimization should reduce your usage by 80-95% in most cases. Start with implementing ISR or the Live Content API with appropriate revalidation times, then optimize your queries and images. Monitor your usage dashboard to see which changes have the biggest impact for your specific use case.

Show original thread
8 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions