Latest / The API Podcast with Fexingo: REST, GraphQL, and Modern Web APIs / Why Your API Calls Are Wasting Bandwidth
Transcript
- Lucas: I was looking at some network logs from a recent audit last week, and it struck me how much money we’re essentially flushing down the toilet every single day through our own API designs. We talk a lot about security and rate limiting, but almost no one talks about the sheer weight of the data we’re forcing mobile users to carry around. Luna: You mean over-fetching? Where the client asks for one thing and gets a hundred? Lucas: Exactly. It’s not just a vanity metric either. When you send a user profile object that includes their avatar, their bio, their friends list, and their transaction history just because the frontend needs to display a name, you are burning bandwidth, memory, and processing cycles on both ends. A major fintech client of ours recently cut their average payload size by sixty percent just by implementing simple field selection. Luna: Sixty percent is massive. Did they switch to GraphQL for that? Lucas: No, and that’s the interesting part. They stayed on REST, which is usually considered rigid. But they introduced a query parameter like fields=name,email,avatar_url and built their serialization layer to respect it. If the client doesn’t ask for the transaction history, the database query skips joining those tables entirely. It’s a small change with a huge structural impact. Luna: So it’s about giving the client control over the shape of the response rather than forcing a static structure on everyone. Lucas: Right. For years, we’ve treated the API contract as a fixed schema. You get what you get. But in a world where people check banking apps on spotty subway connections or in crowded stadiums, that rigidity is expensive. Every extra kilobyte translates to slower load times, higher churn, and bigger cloud bills. We need to stop thinking of endpoints as factories that produce finished goods and start treating them as warehouses where clients pick their items. Luna: It feels like we’ve been stuck in the era of fat clients consuming thin APIs, when really the bottleneck is often the network itself. Lucas: Spot on. And the irony is that many of these APIs were designed for internal dashboards where speed didn’t matter. Now those same endpoints are being hit by millions of iOS and Android devices trying to render complex UIs under five seconds. The architecture hasn’t caught up to the usage pattern. Luna: Does this create more work for backend engineers though? Managing dynamic field requests sounds like a maintenance headache. Lucas: It does require discipline, but modern frameworks make it easier than you’d think. You can use libraries that automatically filter out fields not requested by the client. The key is defining a default set of fields for each endpoint. If nothing is specified, you return the standard view. If specific fields are asked for, you return only those. It’s not rocket science, it’s just good hygiene. Luna: I guess I always assumed that returning extra data was harmless, like leaving a few seats empty on a bus. Lucas: On a bus, maybe. In digital infrastructure, every byte has a cost. There’s the bandwidth cost for your provider, the CPU cost for parsing the JSON, the memory cost for the application heap, and the battery cost for the user’s device. When you aggregate that across ten million daily active users, it stops being negligible and starts becoming a line item in your CFO’s budget. Luna: So it’s an operational efficiency play disguised as a technical optimization. Lucas: Precisely. And it’s one of those things that doesn’t show up in a unit test. You won’t find out your API is bloated until you look at the production metrics. Most teams monitor error rates and latency, but they rarely track payload size per request. That’s a blind spot. Luna: I wonder if this also affects how we version APIs. If the payload shape is flexible, do we even need v1 and v2? Lucas: That’s a great question. Versioning becomes less about changing the structure and more about changing the semantics. If you allow field selection, you can deprecate old fields without breaking clients that never asked for them anyway. It actually simplifies evolution. You don’t have to maintain backward compatibility for data nobody uses. Luna: It shifts the burden of complexity from the server to the client, which might not be popular with frontend teams. Lucas: Frontend teams usually love it once they see the performance gains. Loading a screen in half the time is a better experience than dealing with a slightly more complex query string. Developers prefer tools that make their apps faster. Luna: Yeah, nobody likes waiting for a spinner. Even if the code behind it is a bit messier. Lucas: Exactly. Speed sells. And in the current market, where user patience is thinner than ever, any millisecond saved is competitive advantage. We’re seeing companies invest heavily in edge computing and CDNs, but they ignore the fact that they’re serving too much data in the first place. It’s like building a superhighway and then clogging it with semi-trucks carrying empty boxes. Luna: That analogy sticks. So the fix isn’t always new technology, it’s just cleaner data handling. Lucas: Sometimes the best technology is just restraint. Knowing what not to send is just as important as knowing what to send. It forces you to think about your domain model more carefully. You have to define what belongs in a profile versus what belongs in a transaction log. Those boundaries get clearer when you’re forced to separate concerns at the API level. Luna: It sounds like a cultural shift as much as a technical one. Getting product managers to agree that we don’t need to surface everything immediately. Lucas: Absolutely. Product teams often want all the features exposed everywhere. But from an engineering standpoint, exposing unused endpoints or fields creates technical debt. It’s clutter. And clutter kills performance. Luna: So this episode is basically a plea for minimalism in API design. Lucas: A plea for efficiency. Minimalism is the result. If you strip away the noise, what’s left is fast, cheap, and reliable. That’s the holy trinity of modern web development. Luna: I’m going to go back and check our own documentation. I suspect we’re guilty of returning way more than necessary on our basic lookup endpoints. Lucas: Do it. And while you’re at it, add that fields parameter. You’ll thank yourself next quarter when your hosting bill drops. Luna: Deal. But before we dive deeper into implementation details, I want to mention something important about how we keep this conversation happening. Lucas: Right, because the ad-free model matters here. We deliberately don't run ads on these shows. If you want to support that choice, the link is buy me a coffee dot com slash fexingo. Luna: It keeps us independent and focused on the tech, not the advertisers. Thanks for keeping us running. Lucas: Let’s get back to the mechanics. How do you handle nested objects when you implement field selection? That’s where it usually gets tricky. Luna: Oh yeah, nesting. If I ask for user.name, do I also get user.address.city? Or do I have to explicitly ask for that too? Lucas: It depends on your parser, but the cleanest approach is strict isolation. If you don’t ask for address, you get null or omitted. No partial data. This prevents accidental leakage of sensitive information like addresses or phone numbers that weren’t intended for that view. Luna: Security by omission. I like that. It’s a safer default than assuming the client knows what they’re doing. Lucas: Exactly. And it simplifies testing. You know exactly what is being sent. There’s no ambiguity about whether a field was included by default or explicitly requested. It makes debugging network issues much easier when you can trace the payload back to a specific query parameter. Luna: So it’s transparency on both sides. The client sees what they asked for, and the server sends exactly that. Lucas: Transparency builds trust. And in API design, trust is everything. If your responses are predictable and lean, developers will adopt your platform faster. Bloat drives people away. Luna: It’s funny how something so simple—asking for less—can have such a big impact on adoption. Lucas: It’s the law of diminishing returns. Adding more features increases complexity exponentially. Removing unnecessary data decreases it linearly. Sometimes subtraction is the best feature you can ship. Luna: I’ll take that advice. Less is more, especially when it comes to bandwidth. Lucas: Always. Especially then.