You built an API. It works. It returns JSON. You tested it with curl and Postman.
Now what?
Most developer content stops at "it works locally." This post is about what comes after — turning a working API into something that earns money on a marketplace.
The API
I built a CBT (Cognitive Behavioral Therapy) Thought Analyzer API. It does three things:
-
POST /analyze— detects 11 cognitive distortions in a thought (all-or-nothing thinking, overgeneralization, mental filter, etc.) -
POST /procrastination— identifies 8 procrastination patterns (perfectionism block, fear of failure, task overwhelm, etc.) -
POST /attachment— classifies attachment style (secure, anxious, fearful, dismissive)
No ML. No NLP library. No external API calls. Just keyword-pattern matching with confidence scoring — the same approach I used in my cognitive distortion detector, but wrapped in a REST API.
Why Pattern Matching > ML for This Domain
I've written about this before: for constrained domains with known output spaces, pattern matching beats ML on precision, latency, cost, and explainability. A cognitive distortion detector has 11 possible outputs — that's the entire known space from decades of CBT research. You don't need a neural network to classify into 11 categories. You need a well-designed keyword dictionary.
The API uses the same principle but adds:
- Confidence scoring (0-1 based on keyword match density)
- Multiple distortion detection (a thought can have more than one)
- CBT reframes (each detected distortion comes with a evidence-based reframe)
The Marketplace Decision
I had the API deployed on Render (free tier). It worked. But "it works" doesn't pay for itself.
Two options:
- Build my own billing — Stripe integration, rate limiting, API keys, usage tracking, invoices. Weeks of work I didn't want to do.
- Use a marketplace — RapidAPI handles billing, rate limiting, API keys, usage tracking, and distribution. They take a cut. I keep building.
I chose option 2.
What RapidAPI Gives You
- Billing: Free tier (100 calls/mo) + Pro ($9.99/5k calls) + Ultra ($49.99/50k calls). You set the tiers.
- API key management: Users get a key on signup. RapidAPI proxies requests to your endpoint with the key.
- Usage analytics: Per-user call counts, revenue, error rates.
- Distribution: RapidAPI has ~3M developers. Your API shows up in search and category browsing.
- Proxy: RapidAPI calls your endpoint. You don't expose your server directly.
The trade-off: RapidAPI takes a cut of revenue (typically 20%). But they handle all the infrastructure I didn't want to build.
The Preparation
Before listing, I needed:
OpenAPI 3.0 spec — describes the API endpoints, request/response schemas, authentication. RapidAPI imports this directly. I wrote a valid 3.0.3 spec with 4 paths and 9 schemas.
Documentation — each endpoint documented with parameters, response examples, error codes, and integration snippets. RapidAPI shows this on the listing page.
SDK — a Python client library so users can call the API without writing HTTP code.
pip install cbt-analyzer, thenfrom cbt_analyzer import CBTAnalyzer; analyzer = CBTAnalyzer(); result = analyzer.analyze("I failed this task, I'm such a loser").Postman collection — for users who want to test in Postman before writing code. Includes example requests and responses for all endpoints.
Pricing strategy — free tier to drive adoption, Pro tier for regular users, Ultra for heavy usage. The free tier is the funnel; the paid tiers are the revenue.
The Listing
The RapidAPI listing itself is straightforward:
- Name: "CBT Thought Analyzer"
- Category: Health & Fitness (or Data)
- Description: what it does, who it's for, example use cases
- OpenAPI spec import
- Pricing tiers
- Endpoint URL (your deployed API)
The marketplace reviews the listing before it goes live — similar to an app store review. Timeline varies.
What I Learned
1. The API is the easy part. The packaging is the hard part.
Building the detector logic took a day. Writing the OpenAPI spec, documentation, SDK, Postman collection, and pricing strategy took three days. The ratio is roughly 1:3 — for every hour building the API, three hours packaging it for distribution.
2. Free tier is not charity. It's the funnel.
100 free calls/month lets developers try the API in their side project. If it works, they hit the limit and upgrade. The free tier is customer acquisition, not generosity.
3. Documentation IS the product.
On a marketplace, users can't see your code. They can only see your docs. If the docs are bad, the API is bad — regardless of how elegant the implementation is. I spent more time on documentation than on any other single task.
4. Pattern matching is a feature, not a limitation.
In the listing description, I explicitly say "No ML, No NLP library." This is a selling point, not a disclosure. Developers who want deterministic, explainable, zero-latency, zero-cost classification prefer pattern matching over a black-box model. The constraint IS the value proposition.
5. The same API, multiple marketplaces.
The same endpoint (https://cbt-thought-analyzer.onrender.com) is listed on RapidAPI AND registered as an AI agent on aitopia.ai. Different audiences (developers vs consumers), same underlying logic. One deployment, multiple revenue surfaces.
The Revenue Question
Will this make money? I don't know yet. The listing is live — the next step is setting pricing tiers and getting it indexed.
But the math is straightforward:
- Pro tier: $9.99/month for 5,000 calls
- If 20 developers subscribe: $200/month
- If 50 developers subscribe: $500/month
- RapidAPI takes ~20%: I keep 80%
20-50 paying developers is not unreasonable for a mental health API on a marketplace with 3M developers. But I won't know until the listing is live and has been indexed for a few weeks.
The Code
The API is Python (Flask), deployed on Render. The detector logic is the same keyword-pattern matching I've written about before — no new algorithm, just a REST wrapper around existing logic.
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/analyze', methods=['POST'])
def analyze():
thought = request.json.get('thought', '')
distortions = detect_distortions(thought)
return jsonify({
'distortions': distortions,
'count': len(distortions),
'reframes': [get_reframe(d) for d in distortions]
})
def detect_distortions(thought):
# Same keyword-pattern matching as the vanilla JS detector
# 11 distortion types, confidence scoring, multi-detection
...
The full code is on GitHub. The OpenAPI spec, SDK, and Postman collection are in the repo too.
Takeaway
If you've built an API and it works, the next question isn't "how do I make it better?" It's "how do I get it in front of people who'll pay for it?"
Marketplaces are one answer. They handle the parts I don't want to build (billing, keys, analytics) and take a cut. The trade-off is worth it if it means I can keep building instead of maintaining billing infrastructure.
The API took a day to build. The packaging took three days. The listing took an hour. Now it's live — and the real question begins: will anyone subscribe?
That's the build-in-public reality: most of the work is not the code. It's everything around the code — the docs, the SDK, the spec, the pricing, the listing. The code is the smallest part.
The CBT Thought Analyzer API is live at https://cbt-thought-analyzer.onrender.com. The RapidAPI listing is live at rapidapi.com/qq1032153999/api/cbt-thought-analyzer. The source code, OpenAPI spec, Python SDK, and Postman collection are all on GitHub.
Top comments (0)