Affiliate program
2 endpoints. Each needs an API key or OAuth token with the scope shown; the key already names its store, so paths start at /v1/store. Generated from the live contract; also in openapi.json.
Program settings and totals
GET
/v1/store/affiliate-programOr name the store: GET /v1/stores/{storeId}/affiliate-program
Response AffiliateProgram
settingsAffiliateSettingsrequiredtotalsobjectrequiredclicks30dintegerrequiredconversions30dintegerrequiredrevenue30dMinorMinorUnitsrequiredowedMinorMinorUnitsrequiredpaidMinorMinorUnitsrequiredpendingMinorMinorUnitsrequired
signupUrlstringrequiredledgerBackedbooleanrequired
Example
curl "https://api.shopfa.st/v1/store/affiliate-program" \
-H "Authorization: Bearer $SHOPFAST_API_KEY"const res = await fetch('https://api.shopfa.st/v1/store/affiliate-program', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SHOPFAST_API_KEY}`,
},
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();import os, requests
res = requests.request(
"GET",
"https://api.shopfa.st/v1/store/affiliate-program",
headers={"Authorization": f"Bearer {os.environ['SHOPFAST_API_KEY']}"},
)
res.raise_for_status()
data = res.json()req, _ := http.NewRequest("GET", "https://api.shopfa.st/v1/store/affiliate-program", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOPFAST_API_KEY"))
res, err := http.DefaultClient.Do(req)Try it with your key
Commission, cookie window, approval and payout rules
PUT
/v1/store/affiliate-programOr name the store: PUT /v1/stores/{storeId}/affiliate-program
Body
enabledbooleancommissionBpsintegercookieDaysintegerapproval"auto" | "manual"holdDaysintegerminPayoutMinorintegertermsstringnewCustomersOnlybooleanreward"cash" | "store_credit"
Response AffiliateProgram
settingsAffiliateSettingsrequiredtotalsobjectrequiredclicks30dintegerrequiredconversions30dintegerrequiredrevenue30dMinorMinorUnitsrequiredowedMinorMinorUnitsrequiredpaidMinorMinorUnitsrequiredpendingMinorMinorUnitsrequired
signupUrlstringrequiredledgerBackedbooleanrequired
Example
curl -X PUT "https://api.shopfa.st/v1/store/affiliate-program" \
-H "Authorization: Bearer $SHOPFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"commissionBps": 1000,
"cookieDays": 30,
"approval": "manual",
"holdDays": 14,
"minPayoutMinor": 2500,
"terms": "Earn a commission on every paid order you refer. Self-referrals and refunded orders do not count.",
"newCustomersOnly": false,
"reward": "cash"
}'const res = await fetch('https://api.shopfa.st/v1/store/affiliate-program', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.SHOPFAST_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"enabled": true,
"commissionBps": 1000,
"cookieDays": 30,
"approval": "manual",
"holdDays": 14,
"minPayoutMinor": 2500,
"terms": "Earn a commission on every paid order you refer. Self-referrals and refunded orders do not count.",
"newCustomersOnly": false,
"reward": "cash"
}),
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();import os, requests
res = requests.request(
"PUT",
"https://api.shopfa.st/v1/store/affiliate-program",
headers={"Authorization": f"Bearer {os.environ['SHOPFAST_API_KEY']}"},
json={
"enabled": True,
"commissionBps": 1000,
"cookieDays": 30,
"approval": "manual",
"holdDays": 14,
"minPayoutMinor": 2500,
"terms": "Earn a commission on every paid order you refer. Self-referrals and refunded orders do not count.",
"newCustomersOnly": False,
"reward": "cash"
},
)
res.raise_for_status()
data = res.json()req, _ := http.NewRequest("PUT", "https://api.shopfa.st/v1/store/affiliate-program", strings.NewReader(`{
"enabled": true,
"commissionBps": 1000,
"cookieDays": 30,
"approval": "manual",
"holdDays": 14,
"minPayoutMinor": 2500,
"terms": "Earn a commission on every paid order you refer. Self-referrals and refunded orders do not count.",
"newCustomersOnly": false,
"reward": "cash"
}`))
req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOPFAST_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)