cURL
curl --request PATCH \
--url https://api.growi.io/api/public/v1/campaign_affiliates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tag": "THEIREXISTINGCODE"
}
'import requests
url = "https://api.growi.io/api/public/v1/campaign_affiliates/{id}"
payload = { "tag": "THEIREXISTINGCODE" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tag: 'THEIREXISTINGCODE'})
};
fetch('https://api.growi.io/api/public/v1/campaign_affiliates/{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.growi.io/api/public/v1/campaign_affiliates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'tag' => 'THEIREXISTINGCODE'
]),
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://api.growi.io/api/public/v1/campaign_affiliates/{id}"
payload := strings.NewReader("{\n \"tag\": \"THEIREXISTINGCODE\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.growi.io/api/public/v1/campaign_affiliates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tag\": \"THEIREXISTINGCODE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growi.io/api/public/v1/campaign_affiliates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tag\": \"THEIREXISTINGCODE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": 3490313,
"tag": "theirexistingcode"
}{
"error": "Not Authenticated"
}{
"error": "This API key is read-only and cannot modify data."
}{
"error": "Sorry, that code is already taken. Please try a different one."
}Organization API
Update Campaign Affiliate
Sets the creator’s default affiliate tag (spoken discount / coupon code) to an exact string. Codes must be unique inside the organization. Fires campaign_affiliate.code_updated.
PATCH
/
campaign_affiliates
/
{id}
cURL
curl --request PATCH \
--url https://api.growi.io/api/public/v1/campaign_affiliates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tag": "THEIREXISTINGCODE"
}
'import requests
url = "https://api.growi.io/api/public/v1/campaign_affiliates/{id}"
payload = { "tag": "THEIREXISTINGCODE" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tag: 'THEIREXISTINGCODE'})
};
fetch('https://api.growi.io/api/public/v1/campaign_affiliates/{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.growi.io/api/public/v1/campaign_affiliates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'tag' => 'THEIREXISTINGCODE'
]),
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://api.growi.io/api/public/v1/campaign_affiliates/{id}"
payload := strings.NewReader("{\n \"tag\": \"THEIREXISTINGCODE\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.growi.io/api/public/v1/campaign_affiliates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tag\": \"THEIREXISTINGCODE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growi.io/api/public/v1/campaign_affiliates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tag\": \"THEIREXISTINGCODE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": 3490313,
"tag": "theirexistingcode"
}{
"error": "Not Authenticated"
}{
"error": "This API key is read-only and cannot modify data."
}{
"error": "Sorry, that code is already taken. Please try a different one."
}Sets the creator’s default affiliate tag (the spoken discount / coupon code) to an exact string. Use this after a creator joins if you want to keep the code they already say on camera, or to migrate an existing roster onto a revenue campaign.
Codes are unique inside your organization. A rename fires
campaign_affiliate.code_updated so any coupons you mint from the webhook tag stay in sync.
For 300+ creators, prefer Bulk Update Campaign Affiliates instead of looping this endpoint (the public API also enforces a 2-second gap between requests).
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | Integer | Campaign-affiliate (enrollment) ID from the list endpoint | Yes |
Request Body
| Field | Type | Description | Required |
|---|---|---|---|
tag | String | New default affiliate tag. Stored lowercase. Must be unique in the org. | Yes |
Request Example
curl -X PATCH "https://api.growi.io/api/public/v1/campaign_affiliates/3490313" \
-H "Authorization: Bearer YOUR_PUBLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tag": "THEIREXISTINGCODE"
}'
Response Example
{
"success": true,
"id": 3490313,
"tag": "theirexistingcode"
}
Authentication
Send your organization’s public API key as a Bearer token. Viewer (read-only) keys cannot call this. See Rate Limits & Authentication.Error Responses
| Status | Body | When |
|---|---|---|
401 | { "error": "Not Authenticated" } | Missing or invalid API key. |
403 | { "error": "This API key is read-only and cannot modify data." } | Viewer key. |
422 | { "error": "Campaign affiliate not found." } | Unknown or foreign enrollment id. |
422 | { "error": "tag is required" } | Missing / blank tag. |
422 | { "error": "Sorry, that code is already taken. Please try a different one." } | Another creator in the org already holds this tag. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Campaign-affiliate (enrollment) ID from GET /campaign_affiliates
Body
application/json
New default affiliate tag. Stored lowercase.
Example:
"THEIREXISTINGCODE"