Skip to main content
GET
/
v1
/
referral
Get User Referral Code
curl --request GET \
  --url https://api.example.com/v1/referral \
  --header 'Authorization: <authorization>' \
  --header 'x-client-key: <x-client-key>'
{
  "code": "FHLSO5",
  "cap": 5,
  "used": 0
}
GET https://api.baanx.com/v1/referral Retrieves the referral code for the authenticated user. If the user is within an active referral campaign, a code will be created and returned. If no active campaign exists, nothing is returned.

Overview

Returns the authenticated user’s referral code along with the cap (maximum number of referrals allowed) and how many have been used. Codes are only issued when an active referral campaign is running for the tenant.

Authentication

This endpoint requires both a client key and a Bearer token:
x-client-key: YOUR_CLIENT_KEY
Authorization: Bearer YOUR_ACCESS_TOKEN

Request

Headers

x-client-key
string
required
Your public API client key
Authorization
string
required
Bearer token for the authenticated user
x-us-env
boolean
default:false
Set to true to route requests to the US backend environment

Request Example

curl -X GET https://api.baanx.com/v1/referral/ \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

200 Success

Returns the user’s referral code details. If no active campaign exists, the response body will be empty.
code
string
The user’s unique referral code (e.g., FHLSO5)
cap
number
Maximum number of successful referrals allowed for this code
used
number
Number of times this referral code has been successfully used
{
  "code": "FHLSO5",
  "cap": 5,
  "used": 0
}

Error Responses

{
  "message": "Not authenticated"
}
  • GET /v1/referral/:code/validate - Validate a referral code entered by a user during registration