# Introduction

**About the Conversion API (CAPI)**

The **Conversion API (CAPI)** in Qube is a system that securely records conversion events **server-side** when a user completes a specific action (conversion).\
By using CAPI, you can reliably track conversions and ensure proper affiliate reward payments without being affected by browser limitations.

This document provides an overview of how to use CAPI and explains the implementation process step by step.

***

**Implementation Steps**

The implementation of CAPI consists of the following **three steps**:

**① Obtain an API Key**\
An **API key** is required to use CAPI for authentication.\
Refer to the **Authentication** section for instructions on how to obtain an API key.

**② Retrieve and Store the `trackingId`**\
When a user **clicks an affiliate link**, they will be redirected to a URL like the following:

```
https://www.0xqube.xyz/?trackingId=7df0a6bb60b4
```

The **`trackingId`** is a unique identifier for tracking user clicks.\
Retrieve this value and **store it until the user completes a conversion**.

In the case of Telegram Mini Apps, the `trackingId` is passed as the `startapp` parameter. Therefore, when retrieving the `trackingId` within a Telegram Mini App, refer to the value of the `startapp` parameter. ([Details](https://core.telegram.org/bots/webapps#direct-link-mini-apps))

**③ Call CAPI When a Conversion Occurs**\
When the user completes a **conversion action** (such as a purchase or registration), call CAPI.\
At this point, send a request with the **stored `trackingId`** along with the necessary data.

***

By following these steps, you can accurately track conversions with Qube.\
The next section provides detailed information on **API authentication**.
