How to analyze high Sanity CDN API usage and identify request sources?

13 replies
Last updated: Nov 29, 2025
Hey folks! Been playing around with Sanity V3, Remix and the Shopify Connect over the last couple of weeks and I’ve noticed we’re getting a huge amount of API CDN requests (hitting about 50k a day 😰 ) Is there any way to get more info out of the usage data to maybe see where this is coming from? Thanks 🙂
AI Update

Good news - you can definitely get more detailed information about those API CDN requests! Sanity has a Request Logs feature that's perfect for tracking down exactly where your usage is coming from.

For self-serve plans, you can download request logs directly:

  1. Go to your project's Usage section at sanity.io/manage
  2. Scroll to the bottom of the page
  3. Download up to 1GB of log data from the last 7 days
  4. You can request a new export every 24 hours

The logs come as GZIPPED NDJSON files and include super helpful fields like:

  • Request Type (API, APICDN, CDN) - so you can see exactly which requests are hitting the CDN
  • Full URL with query parameters
  • GROQ Query Identifier - lets you group similar queries together
  • Referrer and User Agent - helps identify where requests are coming from
  • Remote IP - can help spot bot traffic or unexpected sources
  • Timestamp - identify patterns or spikes

Pro tip: Use Request Tags to track down sources

This is probably the most useful thing for your situation. You can add the tag query parameter or X-Sanity-Client-Tag header to your requests to label them. This makes it super easy to see which parts of your app are generating the most requests.

If you're using @sanity/client, you can set this up at two levels:

const client = createClient({
  projectId: "<project>",
  dataset: "<dataset>",
  useCdn: false,
  apiVersion: "2024-01-24",
  requestTagPrefix: "remix-app" // Added to every request
});

// Then tag specific requests
const products = await client.fetch('*[_type == "product"]', {
  tag: `product-page`, // Results in tag=remix-app.product-page
});

Analyzing the logs

Once you've downloaded the logs, you can convert them to CSV for easier analysis:

gunzip --stdout [logfile].ndjson.gz | npx json2csv --ndjson --output output.csv

You can also use tools like jq, GROQ CLI, or even upload samples to ChatGPT to help analyze patterns.

Common culprits for high CDN usage:

  • Missing dependencies in useEffect hooks causing request loops
  • Shopify webhook integrations making excessive calls
  • Bot traffic
  • Queries running on every render instead of being properly cached

Since you're using Remix + Shopify Connect, I'd especially check if your Shopify webhooks or product sync logic might be triggering more fetches than expected. The request logs will show you the exact URLs and patterns so you can pinpoint it!

Show original thread
13 replies

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.

Was this answer helpful?