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

# Referral Codes

> Track orders, unlock features, and enable auto-cancellation with referral codes

A referral code is your unique identifier when integrating with deBridge. Beyond tracking points and affiliate fees, it enables
analytics, feature toggles, and improved user experience.

### DLN Referral Codes

For [deBridge Liquidity Network (DLN)](/home/products/dln-overview) integrations, referral codes are generated on-chain and enable
additional features like auto-cancellation.

## What Referral Codes Enable

| Capability          | Description                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------- |
| **Order Tracking**  | See all orders created through your integration                                                          |
| **Analytics**       | Monitor volume, fees, and user activity                                                                  |
| **Feature Toggles** | Enable DLN features like [auto-cancellation](/dln-details/affiliates/auto-cancellations) per integration |
| **Custom Support**  | Faster debugging with order attribution                                                                  |

## Getting a Referral Code

<Steps>
  <Step title="Visit the Referral Page">Go to [app.debridge.com/refer](https://app.debridge.com/refer)</Step>
  <Step title="Connect Your Wallet">Connect the wallet you want associated with your code</Step>

  <Step title="Select Network">
    Choose **Polygon** for the cheapest generation fee. The code works across all supported chains including Solana.
  </Step>

  <Step title="Generate">Click generate and save your code (e.g., `7895`)</Step>
</Steps>

## Using Your Code

### API Integration

Include `referralCode` in your
[`create-tx` requests](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#referral-code).
More details are available in the API documentation.

### Widget Integration

Set the `r` parameter in your [widget configuration](/dln-details/widget/deBridge-widget).

## Tracking Orders

Query all orders associated with your referral code using the tracking API:

See the full
[order tracking documentation](/dln-details/integration-guidelines/order-creation/order-tracking-api/tracking-orders#by-referralcode)
for available filters and response fields.

### Code Example

A complete working example is available on GitHub:
[get-orders-by-referral-code.ts](https://github.com/debridge-finance/api-integrator-example/blob/master/src/scripts/orders/queries/get-orders-by-referral-code.ts)

## Auto-Cancellation Feature

For DLN integrations, referral codes unlock **[auto-cancellation](/dln-details/affiliates/auto-cancellations)**—automatic
cancellation of unfulfilled orders after a timeout, improving user experience.

### How It Works

* **Unprofitable orders**: Cancelled after 5 minutes
* **Other issues**: Cancelled after 15 minutes
* **Cost**: Subsidized by deBridge
* **Result**: Users don't need to manually cancel failed orders

### Enabling Auto-Cancellation

This feature requires approval from deBridge:

1. Contact deBridge to request the feature
2. Configure required parameters (`srcAllowedCancelBeneficiary`)
3. deBridge reviews your integration
4. Feature is enabled for your referral code

<Warning>
  When auto-cancellation is enabled, the `dstChainOrderAuthorityAddress` is overridden to a deBridge-controlled address. Ensure
  `srcAllowedCancelBeneficiary` is set to the user's wallet to receive refunds.
</Warning>

See the full [auto-cancellation documentation](/dln-details/affiliates/auto-cancellations) for technical details.

## Technical References

<CardGroup cols={2}>
  <Card title="API Parameters" href="/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#referral-code">
    Full referralCode parameter specification
  </Card>

  <Card title="Order Tracking" href="/dln-details/integration-guidelines/order-creation/order-tracking-api/tracking-orders">
    Query orders by referral code
  </Card>

  <Card title="Auto-Cancellation" href="/dln-details/affiliates/auto-cancellations">
    Automatic order cancellation setup
  </Card>

  <Card title="Widget Reference" href="/dln-details/widget/deBridge-widget">
    Widget configuration options
  </Card>
</CardGroup>
