> ## Documentation Index
> Fetch the complete documentation index at: https://developers.referly.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Referly is an Affiliate Marketing Software and Network that lets you easily Track, Manage and Partner with Affiliates. This is the Custom API documentation that details how to use the API to track payments and attribute proper commissions.

<img className="block" src="https://mintcdn.com/pushlapgrowth/Kgf273m3Sfv2f_w5/images/manage-affiliates-1.jpg?fit=max&auto=format&n=Kgf273m3Sfv2f_w5&q=85&s=375ef07aade22236ba9cc8588c22ec3c" style={{ borderRadius: "10px" }} alt="Hero Dark" width="2560" height="1350" data-path="images/manage-affiliates-1.jpg" />

<Note>
  The API is a premium feature that's only available to users who have an active
  Business Plan. [See Pricing Page](https://referly.so/pricing)
</Note>

## Welcome

To be able to use this API, you need to have created your Affiliate Program and entered all necessary details.

<Card title="Create Affiliate Program" icon="computer" href="https://referly.so/dashboard">
  Create your Affiliate Program and integrate the tracking code to your website.
</Card>

## Authentication

All API endpoints are authenticated using Bearer tokens, this requires you to have completed creating your Affiliate Program. Here's how you create an Auth Token:

Step 1. Click on `API Keys` on your dashboard sidebar:

<img className="block" src="https://mintcdn.com/pushlapgrowth/Kgf273m3Sfv2f_w5/images/step-1.png?fit=max&auto=format&n=Kgf273m3Sfv2f_w5&q=85&s=87bb8c02e7739767552afc488d263e59" style={{ borderRadius: "10px" }} alt="Hero Dark" width="534" height="294" data-path="images/step-1.png" />

Step 2. Click on `Generate New API Key +`:

<img className="block" src="https://mintcdn.com/pushlapgrowth/Kgf273m3Sfv2f_w5/images/step-2.png?fit=max&auto=format&n=Kgf273m3Sfv2f_w5&q=85&s=77501b00c285ce8d02c07ea70e352a42" style={{ borderRadius: "10px" }} alt="Hero Dark" width="2372" height="384" data-path="images/step-2.png" />

Step 3. Click the copy icon to copy your Auth Token:

<img className="block" src="https://mintcdn.com/pushlapgrowth/Kgf273m3Sfv2f_w5/images/step-3.png?fit=max&auto=format&n=Kgf273m3Sfv2f_w5&q=85&s=829e41e4f32f9fcb2b6718b6384c92e9" style={{ borderRadius: "10px" }} alt="Hero Dark" width="1132" height="218" data-path="images/step-3.png" />

Step 4. Add your Auth Token to your API requests:

```json theme={null}
{
  "Authorization": "Bearer <YOUR_TOKEN>"
}
```

## Understanding Coupons & Promotional Codes

The API includes powerful coupon and promotional code management features. Here's how they work together:

### Coupons: The Discount Definition

**Coupons** define the structure and rules for discounts in your affiliate program. Think of them as templates that specify:

* **Discount Type**: Percentage (e.g., 20% off) or Flat amount (e.g., \$10 off)
* **Discount Value**: The actual amount or percentage
* **Duration**: One-time use, forever, or repeating for X months
* **Restrictions**: Product limits, expiration dates, maximum redemptions

### Promotional Codes: The Customer-Facing Codes

**Promotional codes** are the actual discount codes that customers enter at checkout. They are linked to coupons and inherit their discount properties.

Key characteristics:

* Each promotional code is associated with one coupon
* Multiple promotional codes can share the same coupon (same discount, different codes)
* Promotional codes can be assigned to specific affiliates for tracking
* Codes can be manually created or auto-generated based on customizable structures

### Example Workflow

1. **Create a Coupon**: Define a 20% discount that lasts for 3 months
2. **Generate Promotional Codes**: Create codes like "JOHN20", "SARAH20", "MIKE20" that all use the same 20% discount
3. **Assign to Affiliates**: Each code is assigned to a different affiliate for tracking
4. **Track Performance**: Monitor which codes are used and attribute sales to the correct affiliates

This two-tier system gives you flexibility to:

* Maintain consistent discount structures across multiple affiliates
* Generate unique codes for each affiliate while keeping the same discount terms
* Update discount terms for all codes by modifying the parent coupon
* Track performance at both the coupon level (overall discount performance) and code level (individual affiliate performance)
