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

# Referral links

> Configure and manage partner referral links

## Overview

Referral links are unique URLs that partners share to track their referrals. When someone clicks a partner's referral link, they're cookied and any subsequent conversion is attributed to that partner.

## Link Formats

Partnero supports multiple referral link formats:

### Query Parameter Links

The most common format using URL parameters:

```
https://yoursite.com/?ref=PARTNER_CODE
https://yoursite.com/?via=PARTNER_CODE
https://yoursite.com/pricing?ref=PARTNER_CODE
```

### Custom Subdomain Links

Professional-looking links using subdomains:

```
https://PARTNER_CODE.yoursite.com
https://john.yoursite.com
```

<Note>
  Custom subdomain links require DNS configuration. Contact support for setup assistance.
</Note>

### Short Links

Partnero can generate short, shareable links:

```
https://go.partnero.com/abc123
```

## Managing Referral Links

### Default Referral Link

Every partner automatically receives a default referral link based on their partner code:

```json theme={null}
{
  "partner": {
    "key": "partner_123",
    "code": "JOHN20",
    "referral_url": "https://yoursite.com/?ref=JOHN20"
  }
}
```

### Custom Links

Partners can create additional custom links for different campaigns:

<Tabs>
  <Tab title="Dashboard">
    Partners can create custom links from their portal:

    1. Go to **Referral Links**
    2. Click **Create New Link**
    3. Set custom destination URL and tracking parameters
  </Tab>

  <Tab title="API">
    ```bash theme={null}
    curl -X POST https://api.partnero.com/v1/partner_referral_links \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "partner_key": "partner_123",
        "destination_url": "https://yoursite.com/special-offer",
        "label": "Black Friday Campaign"
      }'
    ```
  </Tab>
</Tabs>

### Link Parameters

Add UTM parameters or custom tracking to links:

```
https://yoursite.com/?ref=JOHN20&utm_source=partner&utm_campaign=summer2024
```

## Link Domains

Configure which domains can be used for referral links:

### Primary Domain

Your main website domain:

```
https://yoursite.com/?ref=CODE
```

### Additional Domains

Add multiple domains for different products or regions:

```bash theme={null}
curl -X GET https://api.partnero.com/v1/partner_referral_links:domains \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "domains": [
    {"domain": "yoursite.com", "primary": true},
    {"domain": "shop.yoursite.com", "primary": false},
    {"domain": "eu.yoursite.com", "primary": false}
  ]
}
```

## Link Analytics

Track performance for each referral link:

| Metric            | Description                 |
| ----------------- | --------------------------- |
| **Clicks**        | Total clicks on the link    |
| **Unique Clicks** | Unique visitors who clicked |
| **Leads**         | Sign-ups from the link      |
| **Conversions**   | Sales from the link         |
| **Revenue**       | Total revenue generated     |

## Referral Link API

### List Partner's Links

```bash theme={null}
curl -X GET https://api.partnero.com/v1/partners/partner_123/referral_links \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Create a Link

```bash theme={null}
curl -X POST https://api.partnero.com/v1/partner_referral_links \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "partner_key": "partner_123",
    "destination_url": "https://yoursite.com/promo",
    "label": "Promo Page"
  }'
```

### Update a Link

```bash theme={null}
curl -X PUT https://api.partnero.com/v1/partner_referral_links/link_456 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Updated Campaign Name"
  }'
```

### Delete a Link

```bash theme={null}
curl -X DELETE https://api.partnero.com/v1/partner_referral_links/link_456 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Coupon Code Tracking

In addition to links, partners can use **coupon codes** for tracking:

```json theme={null}
{
  "partner_key": "partner_123",
  "coupon_code": "JOHN20",
  "discount_type": "percentage",
  "discount_value": 20
}
```

When a customer uses the coupon code at checkout, the sale is attributed to the partner.

## Next Steps

<CardGroup cols={2}>
  <Card title="Track Transactions" icon="receipt" href="/guides/tracking/transactions">
    Learn how transactions are tracked
  </Card>

  <Card title="Referral Links API" icon="code" href="/api-reference/partners/get">
    Full API documentation
  </Card>
</CardGroup>
