Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.link({
code: "ada",
});<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->link([
'code' => 'ada',
]);
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.link(code="ada")
curl --request PUT \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"code": "ada"
}'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link"
payload := strings.NewReader("{\n \"code\": \"ada\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"ada\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"ada\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"member": true,
"canJoin": false,
"offered": {
"commission": 10,
"discount": 5
},
"active": true,
"code": "ada-keys",
"link": "https://northwind.myshoply.gg/?ref=ada-keys",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 20,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 12.5,
"currencyCode": "USD"
},
"paidOut": {
"amount": 0,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [],
"changes": [
{
"id": "6b4221ce-60ee-4856-99c2-8efe0af9321b",
"kind": "add",
"amount": 12.5,
"balanceAfter": 12.5,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
}
],
"limits": {
"codeMin": 2,
"codeMax": 40,
"details": 300
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Customer API
Change the link's code
What the affiliate’s link ends in, where the store lets affiliates choose it. The old link stops working. Answers the affiliate page.
Needs the buyer’s token: Authorization: Bearer shoply_ct_..., from Sign in with the code.
It is counted for the buyer’s token: 30 changes in ten minutes.
PUT
/
stores
/
{storeId}
/
customer
/
affiliate
/
link
Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.link({
code: "ada",
});<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->link([
'code' => 'ada',
]);
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.link(code="ada")
curl --request PUT \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"code": "ada"
}'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link"
payload := strings.NewReader("{\n \"code\": \"ada\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"ada\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"ada\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"member": true,
"canJoin": false,
"offered": {
"commission": 10,
"discount": 5
},
"active": true,
"code": "ada-keys",
"link": "https://northwind.myshoply.gg/?ref=ada-keys",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 20,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 12.5,
"currencyCode": "USD"
},
"paidOut": {
"amount": 0,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [],
"changes": [
{
"id": "6b4221ce-60ee-4856-99c2-8efe0af9321b",
"kind": "add",
"amount": 12.5,
"balanceAfter": 12.5,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
}
],
"limits": {
"codeMin": 2,
"codeMax": 40,
"details": 300
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A buyer's token, from Sign in with the code: Authorization: Bearer shoply_ct_.... It reaches that buyer's own orders at one store, and no route that takes a key.
Path Parameters
The store's ID, from Settings, General in its dashboard. It is not a secret: a page may show it.
Body
application/json
What the link ends in: letters, digits and dashes, as long as limits on the affiliate page says. One affiliate a code in a store.
Example:
"ada"

