---
title: "Referral deep link handler"
method: GET
path: "/ref/{memberID}"
tags: ["referral"]
---

# Referral deep link handler

`GET /ref/{memberID}`

Handles referral link clicks with backend device detection. This endpoint:
    - Detects user's device OS from User-Agent header (Android/iOS/Desktop)
    - If app installed: Opens app with member ID via Universal Links (iOS) or App Links (Android)
    - If not installed: Redirects to App Store/Play Store based on detected OS
    - Supports deferred deep linking via Universal Links/App Links (opens app after installation)
    
    **Flow:**
    1. User clicks referral link: https://api.tonewow.com/ref/TWE-123456 or https://api.tonewow.com/ref/TWP-123456
    2. Backend detects device OS from User-Agent
    3. Serves appropriate HTML page that attempts to open app via deep link
    4. Falls back to store if app not installed
    5. After installation, Universal Links/App Links automatically open app with referral code

## Path parameters

- `memberID` string, required

## Query parameters

- `utm_source` string
- `utm_medium` string
- `utm_campaign` string

## Response `200`

---

[API](https://skmtc.dev/tonewow/apis/tonewow-database-api.md) · [All operations](https://skmtc.dev/tonewow/apis/tonewow-database-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/tonewow/tonewow-database-api/revisions/f36472974ad4/schema)
