# Create Content APIs in MoEngage

> To integrate Talon.One with MoEngage, you can create a Content API in MoEngage for each of the following supported generic CEP integration endpoints:

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

- [Create coupon](/docs/dev/technology-partners/moengage/moengage-create-content-apis.md#create-coupon)
- [Create referral](/docs/dev/technology-partners/moengage/moengage-create-content-apis.md#create-referral)
- [Fetch loyalty ledger](/docs/dev/technology-partners/moengage/moengage-create-content-apis.md#fetch-loyalty-ledger)

## Set up the integration

<StepsContainer>

### Create an API key in Talon.One

In the Campaign Manager, create an API key of type **Customer Engagement Platform**,
which you can use with MoEngage:

1. In your Application, click <Settings className="icon" /> **Settings** > **Integration API Keys**.
1. Click <Add className="icon" /> **Create API Key**.
1. In the **Create API Key** drawer, if you are asked for a key type, select **Production**.
1. In **Key name**, type a name to identify the key.
1. In **Key expiration date**, select a date.

   :::tip
   Avoid choosing expiration dates that fall at the end of the year or during other
   high-traffic periods.
   :::

1. In **Third-party integration**, select **Yes**.
1. From **Platform**, select **{props.partner}**.
1. Click **Create API Key**.
1. Click <Copy className="icon" /> to copy the key for use.

:::note
You cannot view or copy the API key after closing the drawer.
:::

Use the key in the `Authorization` header of each of the endpoints. For example:

```
Authorization: ApiKey-v1 dbc644d33aa74d582bd9479c59e16f970fe13bf3
```

### Create Content APIs in MoEngage

In MoEngage, based on the Talon.One content you want to use in your campaign,
create a Content API for each of the [supported endpoints](/docs/dev/technology-partners/moengage/moengage-create-content-apis.md#supported-endpoints).

To create a Content API in MoEngage:

1. On the MoEngage dashboard, click **Settings** > **APIs** > **Content API**.
1. Click **Add**.
1. In the **Add Content API** window, enter the required endpoint parameters and headers.
1. Click **Save**.

The endpoint is saved under **Content API**.

### Use the Content APIs

You can now use the Content API that you created for a supported Talon.One endpoint
in your MoEngage campaigns.

For example, to display a generated coupon code
in an email template of your [email campaign][email campaign], use the following code:

```jinja2
{% set couponAPI = ContentApi.Create_coupon({({"params":{},"static_params":{},"dynamic_params":{},"request_body":{}})}) %}
{% for coupon in couponAPI.Value %} {{coupon}} {% endfor %}
```

To learn how to use Content APIs in MoEngage, see the MoEngage documentation:

- [Using Content APIs in MoEngage](https://help.moengage.com/hc/en-us/articles/115003622346-Content-APIs#01H7YH45YQGK9DEKJZB04FMX2M_MODIFIED)
- [MoEngage Templating Language (JINJA)](https://help.moengage.com/hc/en-us/articles/115002757783-MoEngage-Templating-Language-JINJA-)

</StepsContainer>

## Supported endpoints

Based on the content needs of your MoEngage campaign,
you can use the following supported generic CEP integration endpoints:

### Create coupon

```text title="GET Create coupon"
https://integration.talon.one/customer_engagement/coupon
```

<Button variant="primary" size="l" href="/third-party-api#tag/Customer-engagement-platforms/operation/cep/createCoupon">
  See API docs
</Button>

### Create referral

```text title="GET Create referral"
https://integration.talon.one/customer_engagement/referral
```

<Button variant="primary" size="l" href="/third-party-api#tag/Customer-engagement-platforms/operation/cep/createReferral">
  See API docs
</Button>

### Fetch loyalty ledger

```text title="GET Get loyalty ledger"
https://integration.talon.one/customer_engagement/loyalty
```

<Button variant="primary" size="l" href="/third-party-api#tag/Customer-engagement-platforms/operation/cep/loyalty">
  See API docs
</Button>

[email campaign]: https://help.moengage.com/hc/en-us/articles/360059171891-Create-Email-Campaign
