Criar Produto
curl --request POST \
--url https://api.example.com/products \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"payment_type": 123,
"product_type": "<string>",
"id_category": 123,
"sale_page": "<string>",
"delivery_type": "<string>"
}
'import requests
url = "https://api.example.com/products"
payload = {
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"payment_type": 123,
"product_type": "<string>",
"id_category": 123,
"sale_page": "<string>",
"delivery_type": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_token: '<string>',
title: '<string>',
cover: '<string>',
amount: 123,
payment_type: 123,
product_type: '<string>',
id_category: 123,
sale_page: '<string>',
delivery_type: '<string>'
})
};
fetch('https://api.example.com/products', 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.example.com/products",
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([
'api_token' => '<string>',
'title' => '<string>',
'cover' => '<string>',
'amount' => 123,
'payment_type' => 123,
'product_type' => '<string>',
'id_category' => 123,
'sale_page' => '<string>',
'delivery_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/products"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/products")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"201": {},
"400": {},
"401": {},
"422": {},
"500": {}
}Produtos
Criar Produto
Cadastra um novo produto na plataforma
POST
/
products
Criar Produto
curl --request POST \
--url https://api.example.com/products \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"payment_type": 123,
"product_type": "<string>",
"id_category": 123,
"sale_page": "<string>",
"delivery_type": "<string>"
}
'import requests
url = "https://api.example.com/products"
payload = {
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"payment_type": 123,
"product_type": "<string>",
"id_category": 123,
"sale_page": "<string>",
"delivery_type": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_token: '<string>',
title: '<string>',
cover: '<string>',
amount: 123,
payment_type: 123,
product_type: '<string>',
id_category: 123,
sale_page: '<string>',
delivery_type: '<string>'
})
};
fetch('https://api.example.com/products', 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.example.com/products",
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([
'api_token' => '<string>',
'title' => '<string>',
'cover' => '<string>',
'amount' => 123,
'payment_type' => 123,
'product_type' => '<string>',
'id_category' => 123,
'sale_page' => '<string>',
'delivery_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/products"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/products")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"payment_type\": 123,\n \"product_type\": \"<string>\",\n \"id_category\": 123,\n \"sale_page\": \"<string>\",\n \"delivery_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"201": {},
"400": {},
"401": {},
"422": {},
"500": {}
}Visão Geral
Este endpoint permite cadastrar um novo produto na plataforma KlivoPay. Produtos são itens que você vende e podem ser digitais ou físicos.Endpoint
POST https://api.klivopay.com.br/api/public/v1/products
Parâmetros
Seu token de autenticação da API KlivoPay
Título/nome do produto
URL da imagem de capa do produto
Valor do produto em centavos. Exemplo: R$ 299,00 =
29900Tipo de pagamento:
1 = Pagamento únicoTipo do produto:
digital ou fisicoID da categoria do produto (use o endpoint de categorias para consultar)
URL da página de vendas do produto
Tipo de entrega para produtos digitais:
email, download, etc.Exemplo de Requisição
curl -X POST 'https://api.klivopay.com.br/api/public/v1/products' \
-H 'Content-Type: application/json' \
-d '{
"api_token": "seu_token_aqui",
"title": "Curso de Marketing Digital",
"cover": "https://exemplo.com/capa.jpg",
"sale_page": "https://meucurso.com.br/marketing",
"payment_type": 1,
"product_type": "digital",
"delivery_type": "email",
"id_category": 5,
"amount": 29900
}'
const response = await fetch('https://api.klivopay.com.br/api/public/v1/products', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_token: 'seu_token_aqui',
title: 'Curso de Marketing Digital',
cover: 'https://exemplo.com/capa.jpg',
sale_page: 'https://meucurso.com.br/marketing',
payment_type: 1,
product_type: 'digital',
delivery_type: 'email',
id_category: 5,
amount: 29900
})
});
const data = await response.json();
console.log(data);
import requests
url = 'https://api.klivopay.com.br/api/public/v1/products'
payload = {
'api_token': 'seu_token_aqui',
'title': 'Curso de Marketing Digital',
'cover': 'https://exemplo.com/capa.jpg',
'payment_type': 1,
'product_type': 'digital',
'id_category': 5,
'amount': 29900
}
response = requests.post(url, json=payload)
print(response.json())
<?php
$url = 'https://api.klivopay.com.br/api/public/v1/products';
$data = [
'api_token' => 'seu_token_aqui',
'title' => 'Curso de Marketing Digital',
'cover' => 'https://exemplo.com/capa.jpg',
'payment_type' => 1,
'product_type' => 'digital',
'id_category' => 5,
'amount' => 29900
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
print_r(json_decode($result));
?>
Resposta de Sucesso
201 Created
{
"success": true,
"data": {
"hash": "prod123abc",
"title": "Curso de Marketing Digital",
"cover": "https://exemplo.com/capa.jpg",
"sale_page": "https://meucurso.com.br/marketing",
"product_type": "digital",
"delivery_type": "email",
"payment_type": 1,
"amount": 29900,
"category": {
"id": 5,
"name": "Educação"
},
"created_at": "2025-01-20T10:15:00Z"
}
}
Códigos de Resposta
Produto criado com sucesso
Dados inválidos na requisição
Token de API inválido ou ausente
Erro de validação nos dados enviados
Erro interno do servidor
⌘I