Back to all labs

Learn RapidAPI Hub (Provider)

In this guide, you will learn about how to add an API to RapidAPI.

Learn RapidAPI Hub as a Provider

Loading component...

About this course

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.

Loading component...

Why should you provide your API inside RapidAPI?

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.

How can you add an API to RapidAPI?

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:

Loading component...
Loading component...

Specifying your API

You can specify your API using the following options:

  • Kafka
  • Specifying a GraphQL Schema
  • Uploading a Postman Collection file
  • Create the spec using the RapidAPI UI
  • Automating the spec by uploading your OpenAPI file

You can select your preferred option and click on the Add API button to continue:

Overview tab

Through the Overview tab, you can add more details like a Long Description, Logo, Website, and Terms of Use for your API:

Add API specs

From the API Specs tab, you can add the Base URL of your API.

Loading component...

You click on the Configure button to enter the Base URL and click on the Save button:

Versioning your APIs

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:

Loading component...

Defining endpoints for your APIs

You can create endpoints for your APIs by selecting the Endpoints tab:

There are two ways of defining your endpoints:

  • REST
  • GraphQL

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:

  • Headers: You can specify custom headers that the consumer will have to send as a part of the request to the API endpoint.
  • Query: Passing a query string is often necessary to provide certain details like offset or limit for paginated queries.
  • Body: The Body can be sent only for 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:

Loading component...

Secret Headers & Parameters

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:

  • You can use these hidden parameters to authenticate your API requests.
  • You can use secret headers and parameters to set environment variables.
Loading component...

How can you secure your APIs?

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:

  • Access control
  • Firewall settings
  • Threat Protection
  • Request schema validation

In this module, you will learn how to secure your APIs on RapidAPI.

Access control

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

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.

Loading component...

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

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

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:

  • Client Credentials
  • Authorization Code
Loading component...

Security

RapidAPI also provides various options to secure your API endpoints.

Firewall Settings

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

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.

Request Schema Validation

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.

Request Configurations

Request Size Limit

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.

Proxy Timeout Setting

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.

How can you manage your APIs on RapidAPI?

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:

  • Adding plans and pricing for your APIs
  • Modifying Gateway DNS settings
  • Inviting developers even to your private APIs
  • Creating documentation for your APIs
  • A place to announce changes and modifications to your APIs

In this module, you will learn how to manage your APIs on RapidAPI.

Plans & Pricing

RapidAPI provides you the flexibility to choose your pricing plan. All APIs on RapidAPI fall into one of four categories:

CategoryDescription
FreeAPIs that do not require a credit card or subscription to consume.
Pay Per UseAPIs 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.
FreemiumPaid APIs that also include a limited free tier. These require a credit card, even for the free plan.
PaidAPIs 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.

Loading component...

Pricing Attributes

You can define objects to set quotas and specify charges per object. You can add objects or features to your plan.

Public & Private Plans

You can have up to four different pricing plans. To add a new plan, you can click the Add Plan button.

Global Settings

From the Global Settings tab, it is possible to:

  • Modify the Gateway DNS.
  • Invite Developers to view and consume your API even though it is private.

There is another section inside this tab through why it is possible to:

  • Change the visibility of your API.
  • Transfer the ownership of this API to another RapidAPI user.
  • Permanently delete this API.

Docs and Announcements

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: