Create Affiliate
curl --request POST \
--url https://api.centralcart.io/v1/app/affiliate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"ref_code": "<string>",
"percent_commission": 123,
"email": "<string>",
"min_withdraw": 123,
"linked_discount_id": 123,
"package_commissions": [
{
"package_id": 123,
"percent_commission": 123
}
],
"withdraw_settings": {
"full_name": "<string>",
"pix_key": "<string>",
"cpf_cnpj": "<string>"
}
}
'import requests
url = "https://api.centralcart.io/v1/app/affiliate"
payload = {
"name": "<string>",
"ref_code": "<string>",
"percent_commission": 123,
"email": "<string>",
"min_withdraw": 123,
"linked_discount_id": 123,
"package_commissions": [
{
"package_id": 123,
"percent_commission": 123
}
],
"withdraw_settings": {
"full_name": "<string>",
"pix_key": "<string>",
"cpf_cnpj": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
ref_code: '<string>',
percent_commission: 123,
email: '<string>',
min_withdraw: 123,
linked_discount_id: 123,
package_commissions: [{package_id: 123, percent_commission: 123}],
withdraw_settings: {full_name: '<string>', pix_key: '<string>', cpf_cnpj: '<string>'}
})
};
fetch('https://api.centralcart.io/v1/app/affiliate', 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.centralcart.io/v1/app/affiliate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'ref_code' => '<string>',
'percent_commission' => 123,
'email' => '<string>',
'min_withdraw' => 123,
'linked_discount_id' => 123,
'package_commissions' => [
[
'package_id' => 123,
'percent_commission' => 123
]
],
'withdraw_settings' => [
'full_name' => '<string>',
'pix_key' => '<string>',
'cpf_cnpj' => '<string>'
]
]),
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.centralcart.io/v1/app/affiliate"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.centralcart.io/v1/app/affiliate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/affiliate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "Afiliado Exemplo",
"ref_code": "AFFILIATE001",
"percent_commission": 10,
"balance": 0,
"min_withdraw": 50,
"email": "[email protected]",
"self_affiliated": false,
"linked_discount_id": null,
"withdraw_settings": {
"full_name": "João da Silva",
"pix_key": "[email protected]",
"pix_key_type": "EMAIL",
"cpf_cnpj": "123.456.789-00"
},
"dash_secret": "REDACTED",
"package_commissions": [],
"created_at": "2024-01-16T15:12:36.000-03:00",
"updated_at": "2024-01-16T15:12:36.000-03:00"
}Afiliados
Create Affiliate
Cria um novo afiliado.
POST
/
app
/
affiliate
Create Affiliate
curl --request POST \
--url https://api.centralcart.io/v1/app/affiliate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"ref_code": "<string>",
"percent_commission": 123,
"email": "<string>",
"min_withdraw": 123,
"linked_discount_id": 123,
"package_commissions": [
{
"package_id": 123,
"percent_commission": 123
}
],
"withdraw_settings": {
"full_name": "<string>",
"pix_key": "<string>",
"cpf_cnpj": "<string>"
}
}
'import requests
url = "https://api.centralcart.io/v1/app/affiliate"
payload = {
"name": "<string>",
"ref_code": "<string>",
"percent_commission": 123,
"email": "<string>",
"min_withdraw": 123,
"linked_discount_id": 123,
"package_commissions": [
{
"package_id": 123,
"percent_commission": 123
}
],
"withdraw_settings": {
"full_name": "<string>",
"pix_key": "<string>",
"cpf_cnpj": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
ref_code: '<string>',
percent_commission: 123,
email: '<string>',
min_withdraw: 123,
linked_discount_id: 123,
package_commissions: [{package_id: 123, percent_commission: 123}],
withdraw_settings: {full_name: '<string>', pix_key: '<string>', cpf_cnpj: '<string>'}
})
};
fetch('https://api.centralcart.io/v1/app/affiliate', 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.centralcart.io/v1/app/affiliate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'ref_code' => '<string>',
'percent_commission' => 123,
'email' => '<string>',
'min_withdraw' => 123,
'linked_discount_id' => 123,
'package_commissions' => [
[
'package_id' => 123,
'percent_commission' => 123
]
],
'withdraw_settings' => [
'full_name' => '<string>',
'pix_key' => '<string>',
'cpf_cnpj' => '<string>'
]
]),
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.centralcart.io/v1/app/affiliate"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.centralcart.io/v1/app/affiliate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/affiliate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"ref_code\": \"<string>\",\n \"percent_commission\": 123,\n \"email\": \"<string>\",\n \"min_withdraw\": 123,\n \"linked_discount_id\": 123,\n \"package_commissions\": [\n {\n \"package_id\": 123,\n \"percent_commission\": 123\n }\n ],\n \"withdraw_settings\": {\n \"full_name\": \"<string>\",\n \"pix_key\": \"<string>\",\n \"cpf_cnpj\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "Afiliado Exemplo",
"ref_code": "AFFILIATE001",
"percent_commission": 10,
"balance": 0,
"min_withdraw": 50,
"email": "[email protected]",
"self_affiliated": false,
"linked_discount_id": null,
"withdraw_settings": {
"full_name": "João da Silva",
"pix_key": "[email protected]",
"pix_key_type": "EMAIL",
"cpf_cnpj": "123.456.789-00"
},
"dash_secret": "REDACTED",
"package_commissions": [],
"created_at": "2024-01-16T15:12:36.000-03:00",
"updated_at": "2024-01-16T15:12:36.000-03:00"
}Autorizações
Token de API gerado no painel da CentralCart.
Corpo
application/json
Nome do afiliado (máximo 56 caracteres)
Código de referência único do afiliado (apenas letras, números, hífen e underscore)
Percentual de comissão do afiliado (entre 1 e 100)
Email do afiliado (opcional)
Valor mínimo para saque
ID do cupom de desconto vinculado ao afiliado
Comissões personalizadas por produto
Show child attributes
Show child attributes
Configurações de saque do afiliado
Show child attributes
Show child attributes
Resposta
200 - application/json
OK
Show child attributes
Show child attributes