Affiliates API
Affiliate Programs
Create Affiliate Program
this api endpoint (post) (post) creates an affiliate program if the request succeeds, it returns an affiliate program object docid\ c8a1zandf7hre4jwqwewe ; otherwise, an error will be returned permissions affiliate programs create webhooks affiliate program events docid\ i5jxxjoruwwcq8efyl 7g body parameters languages object the titles and descriptions of the affiliate program in all supported languages the minimum information required is a title in at least one language the object's keys are a appendix docid\ kfbmx4q3dxjtduqf75yx1 , while the values are also objects with the content of the affiliate program note a language has to be activated on your account before it can be used exampe "languages" { "en" { "label" "20% commission", "description" "awesome affiliate program with 20% recurring commission" }, "de" { // german content }, "sv" { // swedish content } } currency string appendix docid\ kfbmx4q3dxjtduqf75yx1 the currency of the affiliate program products array of strings an array of product ids commission will be credited for purchases referred by affiliates that contain at least one of these products commission amount integer the fixed commission amount credited on every sale referred by an affiliate commission percent percent the commission percentage credited on every sale referred by an affiliate payments array of strings appendix docid\ kfbmx4q3dxjtduqf75yx1 the payout methods for the affiliate program when set, affiliates choose any of these payment methods as a payout option destinations array of strings ( appendix docid\ kfbmx4q3dxjtduqf75yx1 ) the country whitelist of the affiliate program when set, only affiliates located in any of the provided countries can join the program for worldwide support \['worldwide'] domain string the id of a domain to associate with the affiliate program is public boolean determines if the affiliate program is publicly visible and affiliates are allowed to join the default value is true auto approve boolean determines if affiliates that join this program are automatically approved the default value is false is listed boolean determines if the affiliate program will be listed in the public affiliate network the default value is false affiliate notifications boolean determines if notifications will be sent to affiliates on every new sale and on every commission refunded the default value is false banners array of strings an array of asset ids to associated with the affiliate program affiliates will be able to download and use these banners cookie expiry integer the lifetime of the affiliate cookie in days the default value is 30 days payout delay integer the delay in days before a commission is credited to an affiliate the default value is 0 days subscription commission type string the commission structure for any billing plans associated with this affiliate program the possible values are once , forever and repeating the default value is once duration integer the number of payments to credit commission for any billing plans associated with this affiliate program required if subscription commission type is set to repeating require "uri" require "json" require "net/http" url = uri("https //api tamio com/v2/affiliate programs/create") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["authorization"] = "bearer your token here" data = { languages { en { label "20% commission", description "awesome affiliate program with 20% recurring commission" } }, products \[ "5730e72d 6512 466f 87b4 2cf058b9a7d8" ], currency "eur", commission amount 0, commission percent 20, destinations \["worldwide"], is public false, payments \["stripe"], domain "bc06950e 226c 4a6f 82b1 bff6fe170374" } request body = data to json response = https request(request) puts response read bodycurl location request post 'https //api tamio com/v2/affiliate programs/create' \\ \ header 'accept application/json' \\ \ header 'authorization bearer your token here' \\ \ data raw '{ "domain" "bc06950e 226c 4a6f 82b1 bff6fe170374", "languages" { "en" { "label" "20% commission", "description" "awesome affiliate program with 20% recurring commission" } }, "products" \[ "5730e72d 6512 466f 87b4 2cf058b9a7d8" ], "currency" "eur", "description" "promote our new line of clothing and receive 20% commission!", "commission amount" 0, "commission percent" 20, "destinations" \["worldwide"], "is public" false, "payments" \["stripe"] }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("authorization", "bearer your token here"); var data = { languages { en { label "20% commission", description "awesome affiliate program with 20% recurring commission" } }, products \[ "5730e72d 6512 466f 87b4 2cf058b9a7d8" ], currency "eur", description "promote our new line of clothing and receive 20% commission!", commission amount 0, commission percent 20, destinations \["worldwide"], is public false, payments \["stripe"], domain "bc06950e 226c 4a6f 82b1 bff6fe170374" }; var body = json stringify(data); var requestoptions = { method 'post', headers myheaders, body body }; fetch("https //api tamio com/v2/affiliate programs/create", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));{ "status" 200, "program" { "object" "affiliate program", "products" \[], "domain" "bc06950e 226c 4a6f 82b1 bff6fe170374", "label" "20% commission", "languages" { "en" { "label" "20% commissionn", "description" "awesome affiliate program with 20% recurring commission" }, }, "created at" 1671639386, "signup url" null, "id" "9d1c6ac2 bf2c 403f 9261 96235d18e5be", "currency" "eur", "commission amount" 0, "commission percent" 20 0, "description" "promote our new line of clothing and receive 20% commission!", "payout delay" 0, "subscription commission type" "once", "destinations" \[ "worldwide" ], "payments" \[ "stripe" ], "is public" false, "auto approve" false, "is listed" false, "payment count" null, "affiliate notifications" false, "banners" null } }