Create promo code (Stripe Only)
curl --request POST \
--url https://api.firstpromoter.com/api/v2/company/promo_codes \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"reward_id": 123,
"promoter_campaign_id": 123,
"description": "<string>",
"metadata": {},
"details": {}
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/promo_codes"
payload = {
"code": "<string>",
"reward_id": 123,
"promoter_campaign_id": 123,
"description": "<string>",
"metadata": {},
"details": {}
}
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({
code: '<string>',
reward_id: 123,
promoter_campaign_id: 123,
description: '<string>',
metadata: {},
details: {}
})
};
fetch('https://api.firstpromoter.com/api/v2/company/promo_codes', 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/promo_codes",
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([
'code' => '<string>',
'reward_id' => 123,
'promoter_campaign_id' => 123,
'description' => '<string>',
'metadata' => [
],
'details' => [
]
]),
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/promo_codes"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\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/promo_codes")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/promo_codes")
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 \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"code": "<string>",
"reward": {
"id": 123,
"name": "<string>"
},
"ext_id": "<string>",
"description": "<string>",
"company_id": 123,
"promoter_campaign_id": 123,
"metadata": {},
"details": {},
"archived_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"code": "<string>"
}Promo Codes
Create promo code (Stripe Only)
With this endpoint you can create a new promo code.
HTTP Request
POST https://api.firstpromoter.com/api/v2/company/promo_codesPOST
/
promo_codes
Create promo code (Stripe Only)
curl --request POST \
--url https://api.firstpromoter.com/api/v2/company/promo_codes \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"reward_id": 123,
"promoter_campaign_id": 123,
"description": "<string>",
"metadata": {},
"details": {}
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/promo_codes"
payload = {
"code": "<string>",
"reward_id": 123,
"promoter_campaign_id": 123,
"description": "<string>",
"metadata": {},
"details": {}
}
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({
code: '<string>',
reward_id: 123,
promoter_campaign_id: 123,
description: '<string>',
metadata: {},
details: {}
})
};
fetch('https://api.firstpromoter.com/api/v2/company/promo_codes', 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/promo_codes",
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([
'code' => '<string>',
'reward_id' => 123,
'promoter_campaign_id' => 123,
'description' => '<string>',
'metadata' => [
],
'details' => [
]
]),
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/promo_codes"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\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/promo_codes")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/promo_codes")
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 \"code\": \"<string>\",\n \"reward_id\": 123,\n \"promoter_campaign_id\": 123,\n \"description\": \"<string>\",\n \"metadata\": {},\n \"details\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"code": "<string>",
"reward": {
"id": 123,
"name": "<string>"
},
"ext_id": "<string>",
"description": "<string>",
"company_id": 123,
"promoter_campaign_id": 123,
"metadata": {},
"details": {},
"archived_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"code": "<string>"
}Authorizations
API key passed as a Bearer token in the Authorization header. You can find your API Key on Your FirstPromoter Dashboard. Navigate to Settings → Integrations section → Manage API Keys
Headers
Account id. You can find your Account ID on Your FirstPromoter Dashboard. Navigate to Settings → Integrations
Body
application/json
Response
Created promo code
ID of the promo code entry
Code of the promo code
Reward
Show child attributes
Show child attributes
Description of the promo code
ID of the promoter campaign
Metadata of the promo code
Details of the promo code
⌘I