Update promo code by id
curl --request PUT \
--url https://api.firstpromoter.com/api/v2/company/promo_codes/{id} \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"description": "<string>",
"promoter_campaign_id": 123,
"metadata": {},
"details": {}
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/promo_codes/{id}"
payload = {
"code": "<string>",
"description": "<string>",
"promoter_campaign_id": 123,
"metadata": {},
"details": {}
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: '<string>',
description: '<string>',
promoter_campaign_id: 123,
metadata: {},
details: {}
})
};
fetch('https://api.firstpromoter.com/api/v2/company/promo_codes/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'description' => '<string>',
'promoter_campaign_id' => 123,
'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/{id}"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\n \"metadata\": {},\n \"details\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.firstpromoter.com/api/v2/company/promo_codes/{id}")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\n \"metadata\": {},\n \"details\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/promo_codes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\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
Update promo code by id
Update promo code by id. Can not be updated if archived and ext_id present.
HTTP Request
PUT https://api.firstpromoter.com/api/v2/company/promo_codes/{id}PUT
/
promo_codes
/
{id}
Update promo code by id
curl --request PUT \
--url https://api.firstpromoter.com/api/v2/company/promo_codes/{id} \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"description": "<string>",
"promoter_campaign_id": 123,
"metadata": {},
"details": {}
}
'import requests
url = "https://api.firstpromoter.com/api/v2/company/promo_codes/{id}"
payload = {
"code": "<string>",
"description": "<string>",
"promoter_campaign_id": 123,
"metadata": {},
"details": {}
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: '<string>',
description: '<string>',
promoter_campaign_id: 123,
metadata: {},
details: {}
})
};
fetch('https://api.firstpromoter.com/api/v2/company/promo_codes/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'description' => '<string>',
'promoter_campaign_id' => 123,
'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/{id}"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\n \"metadata\": {},\n \"details\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.firstpromoter.com/api/v2/company/promo_codes/{id}")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\n \"metadata\": {},\n \"details\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/company/promo_codes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"description\": \"<string>\",\n \"promoter_campaign_id\": 123,\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
Path Parameters
ID of the promo code
Body
application/json
Response
Updated 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