Atualizar Produto
curl --request PUT \
--url https://api.example.com/products/{hash} \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"sale_page": "<string>",
"product_type": "<string>",
"id_category": 123
}
'import requests
url = "https://api.example.com/products/{hash}"
payload = {
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"sale_page": "<string>",
"product_type": "<string>",
"id_category": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_token: '<string>',
title: '<string>',
cover: '<string>',
amount: 123,
sale_page: '<string>',
product_type: '<string>',
id_category: 123
})
};
fetch('https://api.example.com/products/{hash}', 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/{hash}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_token' => '<string>',
'title' => '<string>',
'cover' => '<string>',
'amount' => 123,
'sale_page' => '<string>',
'product_type' => '<string>',
'id_category' => 123
]),
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/{hash}"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/products/{hash}")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{hash}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"404": {},
"422": {},
"500": {}
}Produtos
Atualizar Produto
Atualiza as informações de um produto existente
PUT
/
products
/
{hash}
Atualizar Produto
curl --request PUT \
--url https://api.example.com/products/{hash} \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"sale_page": "<string>",
"product_type": "<string>",
"id_category": 123
}
'import requests
url = "https://api.example.com/products/{hash}"
payload = {
"api_token": "<string>",
"title": "<string>",
"cover": "<string>",
"amount": 123,
"sale_page": "<string>",
"product_type": "<string>",
"id_category": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_token: '<string>',
title: '<string>',
cover: '<string>',
amount: 123,
sale_page: '<string>',
product_type: '<string>',
id_category: 123
})
};
fetch('https://api.example.com/products/{hash}', 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/{hash}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_token' => '<string>',
'title' => '<string>',
'cover' => '<string>',
'amount' => 123,
'sale_page' => '<string>',
'product_type' => '<string>',
'id_category' => 123
]),
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/{hash}"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/products/{hash}")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{hash}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"cover\": \"<string>\",\n \"amount\": 123,\n \"sale_page\": \"<string>\",\n \"product_type\": \"<string>\",\n \"id_category\": 123\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"404": {},
"422": {},
"500": {}
}Visão Geral
Este endpoint permite atualizar as informações de um produto já cadastrado na plataforma KlivoPay.Endpoint
PUT https://api.klivopay.com.br/api/public/v1/products/{hash}
Parâmetros
Hash identificador único do produto
Seu token de autenticação da API KlivoPay
Novo título/nome do produto
Nova URL da imagem de capa
Novo valor em centavos
Nova URL da página de vendas
Tipo do produto:
digital ou fisicoNovo ID da categoria
Exemplo de Requisição
curl -X PUT 'https://api.klivopay.com.br/api/public/v1/products/prod123abc' \
-H 'Content-Type: application/json' \
-d '{
"api_token": "seu_token_aqui",
"title": "Curso Completo de Marketing Digital",
"amount": 39900
}'
const hash = 'prod123abc';
const response = await fetch(
`https://api.klivopay.com.br/api/public/v1/products/${hash}`,
{
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_token: 'seu_token_aqui',
title: 'Curso Completo de Marketing Digital',
amount: 39900
})
}
);
const data = await response.json();
console.log(data);
import requests
hash_id = 'prod123abc'
url = f'https://api.klivopay.com.br/api/public/v1/products/{hash_id}'
payload = {
'api_token': 'seu_token_aqui',
'title': 'Curso Completo de Marketing Digital',
'amount': 39900
}
response = requests.put(url, json=payload)
print(response.json())
<?php
$hash = 'prod123abc';
$url = "https://api.klivopay.com.br/api/public/v1/products/{$hash}";
$data = [
'api_token' => 'seu_token_aqui',
'title' => 'Curso Completo de Marketing Digital',
'amount' => 39900
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'PUT',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
print_r(json_decode($result));
?>
Resposta de Sucesso
200 OK
{
"success": true,
"data": {
"hash": "prod123abc",
"title": "Curso Completo de Marketing Digital",
"cover": "https://exemplo.com/capa.jpg",
"amount": 39900,
"updated_at": "2025-01-20T15:30:00Z"
}
}
Códigos de Resposta
Produto atualizado com sucesso
Dados inválidos na requisição
Token de API inválido ou ausente
Produto não encontrado
Erro de validação nos dados enviados
Erro interno do servidor
⌘I