---
title: "Capture Referral"
method: POST
path: "/api/auth/capture-referral"
tags: ["auth"]
---

# Capture Referral

`POST /api/auth/capture-referral`

## Request

- Base URL: `https://api.equity-rank.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.equity-rank.com/api/auth/capture-referral`
- Auth: HTTP bearer

Persist the er_ref cookie value at signup time so the Stripe webhook can
auto-redeem on subscription start. Validates code format only — the actual
redeem (with self-referral / dedup / cap checks) runs in the webhook via
referral._redeem_referral_for_user.

Idempotent: upsert by user_id; subsequent calls overwrite the pending code,
which matches "newest share link wins" behavior in the cookie write site.

## Request body

- CaptureReferralRequest
  - `code` string, required

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/equity-rank/apis/equity-rank-api.md) · [All operations](https://skmtc.dev/equity-rank/apis/equity-rank-api/llms.txt) · [OpenAPI document](https://skmtc.dev/equity-rank/apis/equity-rank-api/revisions/c2f2463fee33?raw)
