# Referral System

Invite your friends and earn XP. It’s simple and idempotent (safe to click multiple times).

## How it works

1. You share your **referral link** (`?ref=<alias-or-address>`).
2. A new user connects wallet on Baddie.
3. If a `ref` is present (URL → cookie → db), we **attach** the inviter:
   * **+100 XP** to inviter (welcome referral)
   * If the invited user later links **X**, inviter gets **+150 XP** more

> We support **aliases** (e.g. `hyperliquid`) via `ref_aliases` collection and raw addresses.\
> Self-ref is not allowed.

## Attach window

A new user has a limited time after their first visit to be attached to an inviter:

* **Window:** `REF_ATTACH_WINDOW_HOURS` (default: **48h**)

If the window expired or user is already attached, the API returns an explicit reason.

## API

See: /api/ref/attach


---

# 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://baddies.gitbook.io/baddies/baddie-dolls/referral-system.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.
