---
title: "Monetizing APIs: a step easier with Moesif"
description: "Monetizing APIs has never been easier with Zuplo and Moesif. Combine Moesif's flexible API monetization with Zuplo's powerful API gateway."
canonicalUrl: "https://zuplo.com/blog/2023/12/20/monetizing-apis-with-moesif"
pageType: "blog"
date: "2023-12-20"
authors: "abdallah"
tags: "API Monetization, Tutorial"
image: "https://cdn.zuplo.com/cdn-cgi/image/fit=crop,width=1200,height=630/assets/3b145040-dfe5-4fcc-8e97-36b894240a88.png"
---
Our mission at Zuplo is to provide companies the best way to get an API in
production including developer portals, authentication, rate limiting and more,
all working together seamlessly and running in an edge network, as close as
possible to each person and computer in the world.

We also wanted to provide our customers a solution to
[monetize and build a business around their APIs](/learning-center/what-is-api-monetization),
enabling any company, small or big, to have an API-first approach. In this post
we explore Zuplo’s new integration with Moesif, enabling developers to build API
business in minutes!

## What is Moesif?

[Moesif](https://www.moesif.com/) enables analytics and monetization for some of
the largest companies in the world across every vertical. By having a direct
integration with Zuplo, developers can quickly monetize their customer’s API
usage. Let’s look a little deeper at some highlights of the platform.

By integrating with Moesif, we can offer our users a straight-forward way of
monetizing APIs easily along with publishing the API.

## Tutorial: Connect Moesif to monetize your API

Let’s monetize an API in Zuplo by connecting it to Moesif. Zuplo would be in
charge of handling your API requests enforcing authentication, security and
providing your API documentation.

Every requests handled by Zuplo would report the information to Moesif’s
platform where you can configure different
[monetization models](https://www.moesif.com/blog/developer-platforms/api-analytics/How-To-Monetize-Your-APIs-Choosing-Your-API-Monetization-Stack/)
for your API.

![Diagram of Zuplo and Moesif](https://cdn.zuplo.com/assets/ab42a678-37fb-416d-a2c5-9b4b345857ed.png)

### Step 1: Create a Zuplo project

[Sign up for Zuplo](https://portal.zuplo.com/signup) and create an empty
project.

![Create project](https://cdn.zuplo.com/assets/f4937c66-ca54-46bf-b6ad-7e282f52a9e0.png)

### Step 2: Add a route to your backend

In this example, we’ll use a free
[Todo List backend API](https://jsonplaceholder.typicode.com) but you can
[connect your own backend to Zuplo](https://zuplo.com/docs/articles/securing-your-backend).

In the _Files_ tab, open the `routes.oas.json` and click on _Add Route,_ and
connect the `/v1/todos` path of your API with the Todo List backend.

Now _Save All_ and use the _Test_ console (find it next to the path) to check
that your API works.

![Add route in Zuplo's editor](https://cdn.zuplo.com/assets/3ff4645a-ea9d-4956-9ed0-c428f2d0eed7.png)

### Step 3: Add Zuplo’s policy for Moesif integration

Zuplo allows you to add built-in policies to your requests so you can have
authentication, rate-limiting and more in just one click. That simple. Same goes
for the Moesif plugin, which once connected to an Moesif instance will start
metering your API.

Click on _Add Policy_ for your route and search for the Moesif plugin.

![Add Moesif's policy](https://cdn.zuplo.com/assets/a921dfcf-70ef-4147-a988-0657ca0bbb2e.png)

### Step 4: Get the configuration of your Moesif instance

Create an account in [Moesif](https://www.moesif.com), and follow the onboard
steps until the _Quick Install_ section. Here you’ll find Zuplo in the _Gateway
Plugins_ section readily available!

Copy the default configuration and paste it in the Moesif plugin’s configuration
in Zuplo.

![Copy config from Moesif](https://cdn.zuplo.com/assets/26485a64-7899-48fc-834f-ac6127d791df.png)

:::info

Make sure to only paste the content under `handler`.

:::

![Paste config here](https://cdn.zuplo.com/assets/fad98746-5f36-4ed0-8f79-d67d5b0e623a.png)

And finally make sure to save your changes in Zuplo!

### Step 5: Test that the integration works

Use the Zuplo _Test_ console once more to test your route, this time make sure
that your integration with Moesif is connected in the onboarding page (this
might take up to 1 minute from the first call).

![Data received in Moesif](https://cdn.zuplo.com/assets/bfb80954-a2fa-4533-ae4e-6c56121d4385.png)

### Step 6: Use API Keys to identify your users

Now that you’re logging requests to Moesif, you can identify your customers by
just adding any API auth plugin in Zuplo. You can use Zuplo’s
[API Key management](https://zuplo.com/features/api-key-management) for that.

In Zuplo, add a new policy to your route’s request flow. Search for
`API Key Authentication` and apply the policy with the default value.

:::info

Make sure that the API Key policy is above Moesif’s, that way the user is
identified before hitting Moesif’s policy. This is typical
[command-chain pattern](https://zuplo.com/docs/articles/policies#how-policies-work)
of Zuplo’s policy.

![Drag API Key policy to the top](https://cdn.zuplo.com/assets/00726072-bbc6-4fb2-b589-7c1159855e4f.png)

:::

Now create an API key by going to _Project Settings > API Key Consumers > Add
New Consumer_ Add your own name to the API key (I added mine - “abdallah”) and
for the metadata field you can leave it with an empty JSON or add any user
metadata. This will also be sent to Moesif which can be helpful to apply
different monetizations models for each customer.

![Create API Key consumer](https://cdn.zuplo.com/assets/5a5fe9ec-58bf-4a30-b76e-2174223eb318.png)

Finally, copy the API key and test in the the _Test_ console of your route by
adding the `Authorization` header.

![Make an authorized request](https://cdn.zuplo.com/assets/0742c3eb-6258-45c0-9c0c-57c30984b716.png)

Check that the user is recognized in Moesif:

![Check data in Moesif](https://cdn.zuplo.com/assets/ed63ebc8-193a-4dd9-8ee9-58e1437a5a3b.png)

You can now explore the requests in Moesif, create analytics, and monetize your
API 💥

## Conclusion: API businesses becoming easier every day

With the combined power of Zuplo and Moesif, it's easier than ever to launch,
secure, and monetize your APIs. This integration is just the beginning!

Let us know what you think in
our [Discord](https://discord.zuplo.com/), [Twitter/X](https://twitter.com/zuplo),
or [Linkedin](https://linkedin.com/zuplo).