Which API calls count as traffic?
All outgoing traffic, whether cached or uncached, counts as traffic on our end. This includes assets (uploading via Storyblok UI and delivered via Image Service), the APIs (content delivery API, Management API, GraphQL API), Webhook payloads, etc. In essence, every API call contributes to the overall traffic count. And yes, the size of what's being sent matters.
You can review the specifics of your API requests for your space on your dashboard.
Let's explore a couple of examples:
Understanding Asset Requests
- Consider the default size of the image below. This default size contributes to the overall traffic size.
- You can utilize Storyblok's Image Service to reduce the image size. Simply adding
/m/
at the end of the image URL significantly reduces its size, reducing your overall traffic. - For even more traffic savings, if you need a smaller image, check out the example below. By specifying the image size, you get a smaller image, saving total traffic and enhancing webpage loading speed for a better-optimized website. Please refer to the Image Service documentation to learn more about further optimization possibilities.
Understanding API Request Sizes
- Let's examine an API request fetching a single story. This represents the size of the JSON payload for a single story retrieval. Excluding fields can help trim down this request's size. Otherwise, this size contributes to your overall traffic.
- Now, consider another API request fetching all stories. The size of this request is depicted in the image above. If you don't require all the stories, utilizing filters can further reduce the JSON size, ultimately saving on your traffic consumption.
By optimizing both asset and API request sizes, you ensure efficient traffic management and contribute to a faster, more optimized website.
Let's say that you have an image size of around 1MB and it is used on a page that receives 100,000 visitors daily, your total traffic would be 100,000 MB or 100 GB daily. In cases like this, it’s best to check if there is a way to reduce the image size. If it’s an animated GIF or a video file, optimizing them can help reduce your total traffic usage. Alternatively, you can serve those images statically from your codebase via your hosting service if that costs you less, reducing overall Storyblok traffic usage.
For insights on optimizing your API calls and implementing effective caching strategies, we recommend exploring our comprehensive guide: Optimizing Your Caching Strategy with Storyblok.