# 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**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0xqube.xyz/qube-api-document/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
