Build and Monetise APIs in 99 seconds

Monetizing an API is a good way of generating revenue quickly. Ask Nijiko!

Sometimes the easiest services are the ones that generate the most traffic and traction. At Mashape, we give everyone a chance of quickly monetizing their API without having to worry about any technical aspects.

Creating an API on the fly with BlockSpring

We’re super happy to see more people building tools to simplify the access to building APIs, one of the services that was featured on HackerNews recently is BlockSpring’s API builder.

At the moment they only support three languages (Python, Ruby and R) but that’s plenty enough for us to build some APIs. They also support many libraries that will quickly get you started with any API.

Let’s see how this works.

  1. I use Requests and JSON library because I like to make things easy
  2. We tell the API provided by clarifai.com to use the “nearest match” algorithm. We also pass in a field called img, basically the URL as a parameter and a random Timestamp (because I’m quite lazy)
  3. We use a POST method to send everything to the end point
  4. Finally, parse the output and send it to the clients

All this takes about 30 seconds to write.

import requests
import json

mash_params = {'nearest': True, 'imageurl': img, 'timestamp':140000}

mash_request = requests.post('http://clarifai.com/api/upload/', data=mash_params)
mash_output = mash_request.json()
print json.dumps(mash_output['files'][0]['predicted_classes'])

Make sure to highlight “img” and associate it to a “string” input field on blockspring. This will make it so the value of the “img” field will be passed on to the API.

Well done, now go ahead and publish the API on blockspring! Here’s my live API.

List and Monetise APIs on Mashape

Listing your API on Mashape is as easy as these 3 steps. BlockSpring’s API page has a hidden API settings menu when you click on the “API” link. This will provide a target base URL which you will need to list your API on Mashape.

* Here is the hidden settings menu on BlockSpring’s API page – just click on API

Blockspring hidden API settings

Now that your API is live on Mashape, let’s add a pricing table to it!

From the pricing page, you can choose to give the API a fixed price by clicking the edit button next to a plan name. Additionally you can specify extra parameters that will affect pricing, for example, setting Quotas. Quotas allow you to charge your customer per request, per endpoint used. If you have an endpoint that does something amazing, and you believe you should charge all customers that use that endpoint, you can do so by simply selecting the endpoint from the dropdown menu and associating a price (per call / per day/month) with it.

Keep in mind this can stack with the base API price (the monthly subscription you might have specified just above).

If you want to dig even further into the pricing world of APIs you can specify features that you might provide and that come with a paid plan.

How to price an API?

There is no better way to price an API, because unlike cakes, APIs aren’t tangible products. Keep in mind that other factors are:

  • Cost of delivery (what if you’re processing tons of information before returning something to the user, surely CPU time will cost you more!)
  • Quality of data (deep analysis or superficial)
  • Size of data returned (more detailed or less detailed)
  • Frequency of access to data (let the user query your API more or less often aka throttling )

There are three common types of models that are used to price an API.

  1. Query limit: When you exceed a prefixed quota (hourly or daily), you will be charged. E.g. If your application is making 100 QPH to the API provider, it’s free. After that, you will be charged with different prices based on the number of API calls you are making.
  2. Single transaction: You buy the API access to a service/component/data for life
  3. Subscription: Monthly payment to have access to a specific API, like Xignite does for financial data.

In some cases, you may also find tiered pricing models. Depending on which pricing model you will be using, make sure it is a fair tariff or developers will not be happy with the bill they will be getting from consuming your API.

Here at Mashape, we offer developers the option to customize their own pricing plan – Basic, Pro, Ultra, Mega. Each of the above plans is fully customizable by the API provider, You!

Power in the hands of developers, sound like the recipe for a great Party!

Party


 

This post was written by an awesome Mashaper:
Orlando likes to talk to developers, API enthusiasts and hackathon goers! Feel free to reach out to him on twitter for any Mashape related questions or general chit-chat