A while back I put a food and nutrition API on RapidAPI. You search any food and get calories and macros, plus barcode lookup, allergen detection, a health score, diet filters and a meal calculator. It's Express and TypeScript on Vercel, using data from USDA FoodData Central and Open Food Facts.
54 people signed up for the free plan. Nobody upgraded. This week I finally dug into why and found two embarrassing problems:
Every lookup by food ID returned 0 calories. USDA's search returns nutrients as {nutrientId, value}, but its single-food lookup nests them as {nutrient: {id}, amount}. My code only read the first format. Search looked fine, but anyone who clicked into a food saw a banana with 0 calories. The fix was one small function that converts the format.
The API was free to anyone who looked. My docs showed the raw Vercel URL, and the server never checked that requests came through RapidAPI, so the paid plans were optional. Now every request has to carry RapidAPI's secret header or it gets a 403.
I also rewrote the listing. It was documenting an endpoint that didn't exist.
What I learned:
Test the endpoint your users hit second, not just the one you demo.
If you sell through a marketplace, make sure it's the only way in.
Automated tests would have caught both bugs on day one. I've added 10 now.
If you're building a fitness, meal-planning or grocery app, the free plan includes 100 requests a month: https://rapidapi.com/squigglymold/api/food-calories-and-macros-api
I'd really like feedback on pricing (PRO is $3.99 for 1,000 requests a month) and on what's missing. What would make you pick this over Edamam or Nutritionix?




Top comments (5)
The 0-calorie banana is such a good example of why the second endpoint matters. One test I'd add: look up the same food through search and then by ID and assert the calories match, that catches the two USDA formats drifting apart again. Also, anyone who saved the raw Vercel URL from the old docs now just gets a 403, so a short error body that points them to the RapidAPI listing might turn a few of those into actual signups.
The search-then-ID check is a good one. Right now my tests check that banana by ID returns 89, but nothing ties that to what search says. If the two formats drift apart again, only one side gets caught. I'll add it.
On the 403: it already does that. A call without RapidAPI's header gets back "Subscribe at rapidapi.com/squigglymold/api/food..." in the error message. Whether anyone reads an error body is another question, but at least the link is there.
Good that the 403 already points people to the right place. Even if few read it, it costs nothing. Are your tests running search and ID against the real data, or against a saved sample? I'd guess drift shows up easier with the real one.
A signup count shows interest, and says nothing about use. Tokenade sends no telemetry, so the counts I have are GitHub stars and downloads, not what anyone runs.
Agreed, and my numbers back that up: of 53 signups (not counting me), 31 never made a single call. The one upside of selling through a marketplace is that it sits in the middle, so I can see every call even though I never added any analytics of my own. Stars and downloads probably overcount even more than signups do.