POST /referrer-claim
curl --request POST \
--url https://api.promostack.app/referrer-claim \
--header 'Content-Type: application/json' \
--data '
{
"uid": "<string>"
}
'import requests
url = "https://api.promostack.app/referrer-claim"
payload = { "uid": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({uid: '<string>'})
};
fetch('https://api.promostack.app/referrer-claim', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promostack.app/referrer-claim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'uid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.promostack.app/referrer-claim"
payload := strings.NewReader("{\n \"uid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.promostack.app/referrer-claim")
.header("Content-Type", "application/json")
.body("{\n \"uid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promostack.app/referrer-claim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"uid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Referrer not found"
}
}
Referrer Endpoints
POST /referrer-claim
Claim available rewards
POST
/
referrer-claim
POST /referrer-claim
curl --request POST \
--url https://api.promostack.app/referrer-claim \
--header 'Content-Type: application/json' \
--data '
{
"uid": "<string>"
}
'import requests
url = "https://api.promostack.app/referrer-claim"
payload = { "uid": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({uid: '<string>'})
};
fetch('https://api.promostack.app/referrer-claim', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promostack.app/referrer-claim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'uid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.promostack.app/referrer-claim"
payload := strings.NewReader("{\n \"uid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.promostack.app/referrer-claim")
.header("Content-Type", "application/json")
.body("{\n \"uid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promostack.app/referrer-claim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"uid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Referrer not found"
}
}
Claim Rewards
Claims all available rewards for a referrer. Returns platform-specific promo codes that the referrer can redeem.Request
string
required
Unique identifier for the referrer (same as used in
/referrer)Example Request
curl -X POST https://api.promostack.app/referrer-claim \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"uid": "user_123"
}'
Response
string
Success message indicating number of rewards claimed
array
Example Response
{
"message": "Successfully claimed 1 reward",
"claimed_rewards": [
{
"reward_id": "660e8400-e29b-41d4-a716-446655440000",
"platform": "ios",
"code": "LOGI-REWARD-ABC123",
"reward_number": 1,
"instructions": "Copy this code and redeem in App Store",
"store_url": "https://apps.apple.com/account/redeem"
}
]
}
Usage in Mobile App
func claimRewards(userId: String) async throws -> ClaimResponse {
let url = URL(string: "https://yejzycmzbcwjsapmkwrq.supabase.co/functions/v1/referrer-claim")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue(apiKey, forHTTPHeaderField: "x-api-key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body = ["uid": userId]
request.httpBody = try JSONEncoder().encode(body)
let (data, _) = try await URLSession.shared.data(for: request)
return try JSONDecoder().decode(ClaimResponse.self, from: data)
}
// Display claimed rewards
func showClaimedRewards(_ response: ClaimResponse) {
let alert = UIAlertController(
title: "🎉 Rewards Claimed!",
message: response.message,
preferredStyle: .alert
)
for reward in response.claimed_rewards {
alert.addAction(UIAlertAction(title: "Copy \(reward.code)", style: .default) { _ in
UIPasteboard.general.string = reward.code
UIApplication.shared.open(URL(string: reward.store_url)!)
})
}
alert.addAction(UIAlertAction(title: "Done", style: .cancel))
present(alert, animated: true)
}
suspend fun claimRewards(userId: String): ClaimResponse {
val client = OkHttpClient()
val json = JSONObject().put("uid", userId)
val request = Request.Builder()
.url("https://yejzycmzbcwjsapmkwrq.supabase.co/functions/v1/referrer-claim")
.post(json.toString().toRequestBody("application/json".toMediaType()))
.addHeader("x-api-key", apiKey)
.build()
val response = client.newCall(request).execute()
return Gson().fromJson(response.body?.string(), ClaimResponse::class.java)
}
// Display claimed rewards
fun showClaimedRewards(response: ClaimResponse) {
val dialog = AlertDialog.Builder(context)
.setTitle("🎉 Rewards Claimed!")
.setMessage(response.message)
response.claimed_rewards.forEach { reward ->
dialog.setPositiveButton("Copy ${reward.code}") { _, _ ->
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboard.setPrimaryClip(ClipData.newPlainText("Reward Code", reward.code))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(reward.store_url)))
}
}
dialog.show()
}
Error Responses
{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Referrer not found"
}
}
When to Call This Endpoint
1
Check Progress First
Call
/referrer to see if rewards are available2
Show Claim Button
If
rewards_earned > 0, show a “Claim Rewards” button3
Claim on User Action
Call
/referrer-claim when user taps the button4
Display Codes
Show all claimed codes with copy buttons
Best Practices
Only show “Claim Rewards” button when rewards are actually available
Display all claimed codes clearly with copy buttons
Provide direct links to App Store/Play Store redemption pages
Show celebration UI (confetti, animation) when rewards are claimed
Don’t auto-claim rewards - let users explicitly claim them for better UX
Multiple Rewards
If a referrer has earned multiple rewards (e.g., reached 5 referrals twice), the response will include multiple codes:{
"message": "Successfully claimed 2 rewards",
"claimed_rewards": [
{
"reward_id": "...",
"platform": "ios",
"code": "LOGI-REWARD-ABC123",
"reward_number": 1,
...
},
{
"reward_id": "...",
"platform": "ios",
"code": "LOGI-REWARD-XYZ789",
"reward_number": 2,
...
}
]
}
⌘I

