In this guide, you will learn about how to add an API to RapidAPI.
This course is an interactive one that will guide you through understanding how you can add your API to RapidAPI.
You can go through the interactive component below to understand how much you can earn by publishing an API on RapidAPI Hub.
Other developers can build their applications using the API that you have built and provided in RapidAPI. You can also generate income by providing a pricing plan for your API.
RapidAPI makes it very easy for you to manage your APIs. You can concentrate on building your APIs, and RapidAPI will take care of the rest - monitoring your APIs, latency, and error rates.
RapidAPI also provides your services like user management and billing that are difficult to set up and manage.
To add an API to RapidAPI, you will need to create an account first.
In this module, you will learn how to list your API in RapidAPI and put it in front of over 3 million developers.
To add a new API to RapidAPI, visit the Provider Dashboard and click on the Add New API button:
You can provide the details like the API Name, Short Description (that appears in search) and Category of your API:
You can specify your API using the following options:
You can select your preferred option and click on the Add API button to continue:
Through the Overview tab, you can add more details like a Long Description, Logo, Website, and Terms of Use for your API:
From the API Specs tab, you can add the Base URL of your API.
You click on the Configure button to enter the Base URL and click on the Save button:
RapidAPI allows you to create versions for your APIs. You can choose to either update an existing version or create a new version.
To create a new version, you can select the Add New Version option from the API Specs dropdown:
You can create endpoints for your APIs by selecting the Endpoints tab:
There are two ways of defining your endpoints:
If you click on the Create REST Endpoint, you will be able to add the Name, Description, External Doc URL, and External Doc Description for the new endpoint.
Next, you will also be able to select the HTTP method and path for your endpoint:
You can also provide the following details along with your endpoint:
POST
, PUT
and PATCH
requests. You can select the expected type of Body.You can also click on the Test Endpoint button to check your new endpoint:
You can also choose to create an example from the response by clicking on the Create example from response button:
RapidAPI allows you to add secret headers and parameters which are sent on every request but are hidden from the API consumers.
There are mainly two uses for secret headers and parameters:
Security is critical to any business. Securing the APIs that you provide will ensure that the consumers of your APIs can run their applications properly. By securing your APIs, you can inspire confidence for your API consumers.
RapidAPI provides various tools to safeguard your APIs. Some of them include:
In this module, you will learn how to secure your APIs on RapidAPI.
RapidAPI implements a single secret key per application across all APIs to minimize friction in testing and implementing APIs. There are other ways to implement authentication for your APIs.
Basic Authentication is a method in which the client has to pass the authentication credentials (a username and password) along with the request to the server via the Authorization header. The syntax looks like the following:
json
Authorization: Basic <credentials>
The Base64 encoding of the username and password joined by a single colon :
is passed in place of credentials
. This is the simplest form of enforcing access control for API requests.
By using Header authentication, API providers can enforce API consumers to add one or more valid authentication-related headers to API requests.
If invalid credentials are passed, the API provider will respond with an unsuccessful response code. The API provider is responsible for verifying these values and returning the proper response to the API consumer.
Query authentication allows API providers to enforce API consumers to add one or more query string parameters to API requests.
If invalid values are passed, the API provider will respond with an unsuccessful response code. The API provider is responsible for verifying these values and returning the proper response to the API consumer.
OAuth2 is the industry-standard protocol for token-based authorization. API providers can authorize only certain capabilities (or scopes) for their APIs. RapidAPI supports two OAuth Grant Types:
RapidAPI also provides various options to secure your API endpoints.
RapidAPI adds a unique X-RapidAPI-Proxy-Secret
header on every API request. This header has a unique value for every API, and if the value is invalid (missing or different), it can be assumed that it isn't coming from the RapidAPI infrastructure.
Threat protection protects your API from SQL or Javascript injection attacks. This protection is optional and is left to the provider to enable or disable.
When enabled, the Content-Type
header must be specified if the request has a body. If the Content-Type
header is not specified, the request will be blocked.
If enabled, RapidAPI will automatically validate a bunch of parameters like path, query, and header during run time and block all invalid requests. This requires a Content-Type
header in requests with a body.
This is the maximum allowed size of a request.
It can be less than or equal to 50 MB, which is the default value. If left empty or configured as 0, the default value is applied. The request size includes the request line, header, and request body.
This is the maximum allowed time for the RapidAPI Gateway to wait for a response.
It can be less than or equal to 180 seconds, which is the default value. If left empty or configured as 0, the default value is applied.
Once you build your APIs, you will need a way to manage them.
RapidAPI Hub provides you with various tools to help you manage your APIs. Some of them are:
In this module, you will learn how to manage your APIs on RapidAPI.
RapidAPI provides you the flexibility to choose your pricing plan. All APIs on RapidAPI fall into one of four categories:
Category | Description |
---|---|
Free | APIs that do not require a credit card or subscription to consume. |
Pay Per Use | APIs that don't have a subscription fee associated with the. A credit card is required as you pay for what you use on the API. |
Freemium | Paid APIs that also include a limited free tier. These require a credit card, even for the free plan. |
Paid | APIs that require a paid subscription plan and credit card to consume. |
You can go through the interactive component below to understand how much you can earn by publishing an API on RapidAPI Hub.
You can define objects to set quotas and specify charges per object. You can add objects or features to your plan.
You can have up to four different pricing plans. To add a new plan, you can click the Add Plan button.
From the Global Settings tab, it is possible to:
There is another section inside this tab through why it is possible to:
The Docs tab can be used to highlight your API's features:
The Announcements tab can be used to send emails to all your API consumers and notify them of an update, a new pricing plan, or other important information about your API: