---
title: "Generate Referral Code"
method: POST
path: "/api/referral/{user_id}/generate"
tags: ["Referral"]
---

# Generate Referral Code

`POST /api/referral/{user_id}/generate`

## Request

- Base URL: `https://api.earmarkiq.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.earmarkiq.app/api/referral/{user_id}/generate`
- Auth: HTTP bearer

Generate a unique referral code for the user (or return existing one).

## Path parameters

- `user_id` string, uuid, required

## Response `200`

Successful Response

- GenerateResponse
  - `referral_code` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/earmarkiq/apis/earmark-api.md) · [All operations](https://skmtc.dev/earmarkiq/apis/earmark-api/llms.txt) · [OpenAPI document](https://skmtc.dev/earmarkiq/apis/earmark-api/revisions/4a2c41907105?raw)
