User
Set Referrer
Creates a referral relationship between a referrer and a referral user in a specific campaign. Both users will be registered if they don’t exist, and campaign entries will be created as needed. The referral user must not have an existing referrer or completed tasks.
POST
/
user
/
referrer
Set Referrer
curl --request POST \
--url https://prod.claimr.io/api/v1/user/referrer \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"referrer": "<string>",
"referral": "<string>",
"platform": "<string>",
"pid": "<string>"
}
'import requests
url = "https://prod.claimr.io/api/v1/user/referrer"
payload = {
"referrer": "<string>",
"referral": "<string>",
"platform": "<string>",
"pid": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referrer: '<string>',
referral: '<string>',
platform: '<string>',
pid: '<string>'
})
};
fetch('https://prod.claimr.io/api/v1/user/referrer', 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://prod.claimr.io/api/v1/user/referrer",
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([
'referrer' => '<string>',
'referral' => '<string>',
'platform' => '<string>',
'pid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://prod.claimr.io/api/v1/user/referrer"
payload := strings.NewReader("{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://prod.claimr.io/api/v1/user/referrer")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.claimr.io/api/v1/user/referrer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {}
}{
"success": true,
"error": {
"code": 400,
"message": "bad request"
}
}{
"success": true,
"error": {
"code": 401,
"message": "unauthorized"
}
}{
"success": true,
"error": {
"code": 403,
"message": "access denied"
}
}{
"success": false
}{
"success": false
}{
"success": true,
"error": {
"code": 500,
"message": "internal error"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Account identifier of the user who is referring (will be registered if doesn't exist)
Account identifier of the user being referred (will be registered if doesn't exist, cannot be same as referrer)
Platform for both users' accounts
Campaign ID (must belong to the authenticated organization)
⌘I
Set Referrer
curl --request POST \
--url https://prod.claimr.io/api/v1/user/referrer \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"referrer": "<string>",
"referral": "<string>",
"platform": "<string>",
"pid": "<string>"
}
'import requests
url = "https://prod.claimr.io/api/v1/user/referrer"
payload = {
"referrer": "<string>",
"referral": "<string>",
"platform": "<string>",
"pid": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referrer: '<string>',
referral: '<string>',
platform: '<string>',
pid: '<string>'
})
};
fetch('https://prod.claimr.io/api/v1/user/referrer', 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://prod.claimr.io/api/v1/user/referrer",
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([
'referrer' => '<string>',
'referral' => '<string>',
'platform' => '<string>',
'pid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://prod.claimr.io/api/v1/user/referrer"
payload := strings.NewReader("{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://prod.claimr.io/api/v1/user/referrer")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.claimr.io/api/v1/user/referrer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referrer\": \"<string>\",\n \"referral\": \"<string>\",\n \"platform\": \"<string>\",\n \"pid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {}
}{
"success": true,
"error": {
"code": 400,
"message": "bad request"
}
}{
"success": true,
"error": {
"code": 401,
"message": "unauthorized"
}
}{
"success": true,
"error": {
"code": 403,
"message": "access denied"
}
}{
"success": false
}{
"success": false
}{
"success": true,
"error": {
"code": 500,
"message": "internal error"
}
}