Endpoint para gerar um Bearer token utilizado como autenticação nos outros endpoints da API.
curl --request POST \
--url https://public-api.kiwify.com/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=be161f42-1d05-4949-8736-1a526c28672d \
--data client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwximport requests
url = "https://public-api.kiwify.com/v1/oauth/token"
payload = {
"client_id": "be161f42-1d05-4949-8736-1a526c28672d",
"client_secret": "a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
client_id: 'be161f42-1d05-4949-8736-1a526c28672d',
client_secret: 'a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx'
})
};
fetch('https://public-api.kiwify.com/v1/oauth/token', 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://public-api.kiwify.com/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://public-api.kiwify.com/v1/oauth/token"
payload := strings.NewReader("client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.kiwify.com/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.kiwify.com/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9hcGlfaW50ZWdyYXRpb25faWQiOiIzNmI1MDZlYS03M2ZmLTQ2NjQtODQ4Zi1iODFjYzllZmU0NzYiLCJzdG9yZV9pZCI6Ilh2UzBxZmtkekNaVGc4eiIsInNjb3BlIjoic3RhdHMgcHJvZHVjdHMgZXZlbnRzIHNhbGVzIHNhbGVzX3JlZnVuZCBmaW5hbmNpYWwgYWZmaWxpYXRlcyB3ZWJob29rcyIsImp0aSI6ImVkNGFlMmUyOWZhZWIxMzUwZjNmMTdjMzExYmM0NjhhIiwiZXhwIjoxNzAxMzQ4NTE1LCJpYXQiOjE3MDEyNjIxMTV9.dJWYnnQv6TREivsL3riYFQPypHg-6RqaGVff8iM4puw",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "stats products events sales sales_refund financial affiliates webhooks"
}{
"error": "auth_error",
"message": "Invalid client: client is invalid"
}Autenticação
Gerar token OAuth
Entenda como adquirir o token Bearer OAuth, necessário para autenticação nas demais rotas da API.
POST
/
oauth
/
token
Endpoint para gerar um Bearer token utilizado como autenticação nos outros endpoints da API.
curl --request POST \
--url https://public-api.kiwify.com/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=be161f42-1d05-4949-8736-1a526c28672d \
--data client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwximport requests
url = "https://public-api.kiwify.com/v1/oauth/token"
payload = {
"client_id": "be161f42-1d05-4949-8736-1a526c28672d",
"client_secret": "a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
client_id: 'be161f42-1d05-4949-8736-1a526c28672d',
client_secret: 'a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx'
})
};
fetch('https://public-api.kiwify.com/v1/oauth/token', 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://public-api.kiwify.com/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://public-api.kiwify.com/v1/oauth/token"
payload := strings.NewReader("client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.kiwify.com/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.kiwify.com/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=be161f42-1d05-4949-8736-1a526c28672d&client_secret=a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9hcGlfaW50ZWdyYXRpb25faWQiOiIzNmI1MDZlYS03M2ZmLTQ2NjQtODQ4Zi1iODFjYzllZmU0NzYiLCJzdG9yZV9pZCI6Ilh2UzBxZmtkekNaVGc4eiIsInNjb3BlIjoic3RhdHMgcHJvZHVjdHMgZXZlbnRzIHNhbGVzIHNhbGVzX3JlZnVuZCBmaW5hbmNpYWwgYWZmaWxpYXRlcyB3ZWJob29rcyIsImp0aSI6ImVkNGFlMmUyOWZhZWIxMzUwZjNmMTdjMzExYmM0NjhhIiwiZXhwIjoxNzAxMzQ4NTE1LCJpYXQiOjE3MDEyNjIxMTV9.dJWYnnQv6TREivsL3riYFQPypHg-6RqaGVff8iM4puw",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "stats products events sales sales_refund financial affiliates webhooks"
}{
"error": "auth_error",
"message": "Invalid client: client is invalid"
}Corpo
application/x-www-form-urlencoded
Resposta
OK
Exemplo:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9hcGlfaW50ZWdyYXRpb25faWQiOiIyZThmMzExMy0wNmE1LTQ4OTAtOTgyNC1iNWM1ZmI3YmZkYTciLCJzdG9yZV9pZCI6IlU5VmNINnlaelJrVDJmQiIsImludGVncmF0aW9uX25hbWUiOiJ0ZXN0ZSIsInNjb3BlIjoic3RhdHMiLCJqdGkiOiJhZTMwZDQ4NjU3NWJmMDBiMDFiNzFkNDFlY2M3OWM5YyIsImV4cCI6MTcwMjU5MDg0NiwiaWF0IjoxNzAyNTA0NDQ2fQ.N8Nl5Coj3bL9M6tkaAE61bL2NnqwhUYfNnRqhTMGElc"
Exemplo:
"Bearer"
Exemplo:
"86400"
Exemplo:
"stats products events sales sales_refund financial affiliates webhooks"
⌘I
