---
title: "Get Or Create Referral Code"
method: GET
path: "/api/referrals/code"
tags: ["referrals"]
---

# Get Or Create Referral Code

`GET /api/referrals/code`

Get the authenticated user's referral code, creating one if it doesn't exist.
If the user has an active code, it will be returned.
If not, a new code will be created and returned.

Returns:
    ReferralCodeResponse with code details

## Headers

- `x-user-id` string, nullable

## Response `200`

Successful Response

- ReferralCodeResponse — Response model for creating a referral code
  - `success` boolean, required
  - `code` string, required
  - `message` string, required
  - `redemptions` integer, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/usecreed/apis/creed-api.md) · [All operations](https://skmtc.net/usecreed/apis/creed-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/usecreed/creed-api/versions/523833f9e819/schema)
