It took me a few minutes to find out that there is a Python library that does all that. Few more minutes of coding, and I had a working prototype.

Once you have a code that does something, it is not that difficult to wrap it up as an API. What might be difficult is to deploy and host it.

2. Deploy it with a serverless architecture

Just a serverless function

I had to process hundreds of articles a few times per hour. All at the same moment. A spike of 200–800 news URLs that have to be analyzed, then nothing for an undefined amount of time.

We were already building our solution on AWS, so I figured out that AWS Lambda should be the best option for this case.

AWS Lambda is a serverless Function-as-a-service tool that runs your code in response to an event. You do not have to maintain servers. You pay only for the time that function is executed.

I deployed a Lambda function. It worked just as it supposed to: it handled hundreds of simultaneous calls by making concurrent invocations. And, you pay only for the time when it is executed.

That was the moment where I thought: “Well, it was quite easy. Does any company sells an API that does that?”

Google search for “article extraction API”

Yes, they exist. It seems like they are doing exactly the same thing as I did for my side-project.

It is good news because:

There is a market for such a thing I have a few examples to compare

Serverless API

Now we have to transform our serverless function to a serverless API.

I used Zappa python package that does all the heavy lifting for me.

I wrote an API with Flask, then deployed it with AWS Lambda and API Gateway through Zappa. The full API code is open-sourced on my GitHub page.

Another great package to deploy your serverless code that works with many programming languages and many cloud providers is Serverless.

On average, my AWS bill for 50,000 calls of my API would be around 0.6 to 0.8$. Excluding Free Tier!

50,000 API calls for a similar solution are in a 30–250$ range.

So, the question is what are the other costs that I should imply to distribute, promote and, more importantly, charge for my API.

Most likely, it will not be enough to make me rich but can be enough to cover my subscription bills for Netflix, Spotify, Leetcode, and others.

3. Distribute through an API Marketplace

According to RapidAPI:

An API marketplace works in the same way as these other online marketplaces, allowing providers to list APIs and developers to consume them. Like other types of marketplaces, a typical API marketplace has several components including a developer portal and an API provider portal. Disclaimer: I am not affiliated/paid/getting any special discounts by RapidAPI at the time I write it. I chose this platform as I believe it is the best one for me.

To release my API on RapidAPI Marketplace, I followed the next procedures:

I deployed an API on AWS with API Gateway and Lambda Created an x-api-key on API Gateway to restrict the access Connected my API to RapidAPI marketplace Shared the x-api-key with RapidAPI

When the end-user makes a call to RapidAPI endpoint (from my API page), it takes care of discounting the token from the user’s plan. Then, RapidAPI makes a call to my API with the x-api-key that I provided.

No matter how many different users are using my API through RapidAPI. For my back-end, it is always identical calls with the same x-api-key.

So, I do not have to manage users in any way: payment collections, usage plans, usage dashboard— all of this is not my burden anymore.

The price for that is 20% of any transaction. No transaction — no pay. For example, if I sell a plan of 100,000 calls/month for 50$ → I get 80% of it (40$).

I do not have to pay to RapidAPI if no one buys any plans.