curl --request POST \
--url https://api.firstpromoter.com/api/v2/company/referrals \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"promoter_campaign_id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 1002,
"percentage": 25
},
{
"promoter_campaign_id": 1003,
"percentage": 30
}
]
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/referrals"
payload = {
"promoter_campaign_id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 1002,
"percentage": 25
},
{
"promoter_campaign_id": 1003,
"percentage": 30
}
]
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
promoter_campaign_id: 123,
email: 'jsmith@example.com',
uid: '<string>',
username: '<string>',
split_details: [
{promoter_campaign_id: 1002, percentage: 25},
{promoter_campaign_id: 1003, percentage: 30}
]
})
};
fetch('https://api.firstpromoter.com/api/v2/company/referrals', 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.firstpromoter.com/api/v2/company/referrals",
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([
'promoter_campaign_id' => 123,
'email' => 'jsmith@example.com',
'uid' => '<string>',
'username' => '<string>',
'split_details' => [
[
'promoter_campaign_id' => 1002,
'percentage' => 25
],
[
'promoter_campaign_id' => 1003,
'percentage' => 30
]
]
]),
CURLOPT_HTTPHEADER => [
"Account-ID: <account-id>",
"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://api.firstpromoter.com/api/v2/company/referrals"
payload := strings.NewReader("{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Account-ID", "<account-id>")
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://api.firstpromoter.com/api/v2/company/referrals")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/referrals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"state": "subscribed",
"metadata": {},
"entry_source": "api",
"created_at": "2023-11-07T05:31:56Z",
"customer_since": "2023-11-07T05:31:56Z",
"promoter_campaign": {
"id": 123,
"campaign_id": 123,
"promoter_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"promoter": {
"id": 123,
"email": "jsmith@example.com",
"name": "<string>"
},
"campaign": {
"id": 123,
"name": "<string>",
"color": "<string>"
}
},
"fraud_check": "no_suspicion",
"created_by_user_email": "jsmith@example.com",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 123,
"promoter_id": 123,
"percentage": 123
}
],
"first_name": "<string>",
"last_name": "<string>",
"website": "<string>",
"comment": "<string>",
"is_expired": true
}{}{
"message": "<string>",
"code": "<string>",
"errors": {}
}Create referral
Create a referral for a promoter campaign by email, uid or username, optionally splitting its commissions with split_details.
curl --request POST \
--url https://api.firstpromoter.com/api/v2/company/referrals \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"promoter_campaign_id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 1002,
"percentage": 25
},
{
"promoter_campaign_id": 1003,
"percentage": 30
}
]
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/referrals"
payload = {
"promoter_campaign_id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 1002,
"percentage": 25
},
{
"promoter_campaign_id": 1003,
"percentage": 30
}
]
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
promoter_campaign_id: 123,
email: 'jsmith@example.com',
uid: '<string>',
username: '<string>',
split_details: [
{promoter_campaign_id: 1002, percentage: 25},
{promoter_campaign_id: 1003, percentage: 30}
]
})
};
fetch('https://api.firstpromoter.com/api/v2/company/referrals', 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.firstpromoter.com/api/v2/company/referrals",
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([
'promoter_campaign_id' => 123,
'email' => 'jsmith@example.com',
'uid' => '<string>',
'username' => '<string>',
'split_details' => [
[
'promoter_campaign_id' => 1002,
'percentage' => 25
],
[
'promoter_campaign_id' => 1003,
'percentage' => 30
]
]
]),
CURLOPT_HTTPHEADER => [
"Account-ID: <account-id>",
"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://api.firstpromoter.com/api/v2/company/referrals"
payload := strings.NewReader("{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Account-ID", "<account-id>")
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://api.firstpromoter.com/api/v2/company/referrals")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/referrals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promoter_campaign_id\": 123,\n \"email\": \"jsmith@example.com\",\n \"uid\": \"<string>\",\n \"username\": \"<string>\",\n \"split_details\": [\n {\n \"promoter_campaign_id\": 1002,\n \"percentage\": 25\n },\n {\n \"promoter_campaign_id\": 1003,\n \"percentage\": 30\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"email": "jsmith@example.com",
"uid": "<string>",
"state": "subscribed",
"metadata": {},
"entry_source": "api",
"created_at": "2023-11-07T05:31:56Z",
"customer_since": "2023-11-07T05:31:56Z",
"promoter_campaign": {
"id": 123,
"campaign_id": 123,
"promoter_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"promoter": {
"id": 123,
"email": "jsmith@example.com",
"name": "<string>"
},
"campaign": {
"id": 123,
"name": "<string>",
"color": "<string>"
}
},
"fraud_check": "no_suspicion",
"created_by_user_email": "jsmith@example.com",
"username": "<string>",
"split_details": [
{
"promoter_campaign_id": 123,
"promoter_id": 123,
"percentage": 123
}
],
"first_name": "<string>",
"last_name": "<string>",
"website": "<string>",
"comment": "<string>",
"is_expired": true
}{}{
"message": "<string>",
"code": "<string>",
"errors": {}
}Authorizations
Headers
Body
Distribute the referral's commissions across multiple promoters. Each entry specifies a split partner and the percentage of every commission they receive. The primary promoter (set by the top-level promoter_campaign_id) automatically receives the remainder. The sum of all percentages must not exceed 100.
Show child attributes
Show child attributes
[
{
"promoter_campaign_id": 1002,
"percentage": 25
},
{
"promoter_campaign_id": 1003,
"percentage": 30
}
]
Response
Referral created successfully
Entry source of the referral. This shows where the referral was captured from. Cookie is set if the referral was captured using the tid cookie, Coupon is for when the referral is captured via a coupon code. Manual admin is for when the referral is added manually by an admin. Manual affiliate is for when the referral is added manually by an affiliate.
api, coupon, cookie, manual_admin, manual_affiliate Fraud check (suspicion) status of the referral. no_suspicion means the referral is clean or was manually cleared. same_ip_suspicion means the referral shares an IP with the promoter. same_promoter_email means the referral email matches the promoter email. ad_source means the referral arrived via a paid ad click.
no_suspicion, same_ip_suspicion, same_promoter_email, ad_source