curl --request PUT \
--url https://api.cakto.com.br/public_api/offers/{id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"price": 123,
"image": "<string>",
"units": 1073741824,
"interval": -1,
"recurrence_period": -1,
"quantity_recurrences": -1,
"trial_days": -1,
"max_retries": -1,
"retry_interval": -1
}
'import requests
url = "https://api.cakto.com.br/public_api/offers/{id}/"
payload = {
"name": "<string>",
"price": 123,
"image": "<string>",
"units": 1073741824,
"interval": -1,
"recurrence_period": -1,
"quantity_recurrences": -1,
"trial_days": -1,
"max_retries": -1,
"retry_interval": -1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
price: 123,
image: '<string>',
units: 1073741824,
interval: -1,
recurrence_period: -1,
quantity_recurrences: -1,
trial_days: -1,
max_retries: -1,
retry_interval: -1
})
};
fetch('https://api.cakto.com.br/public_api/offers/{id}/', 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.cakto.com.br/public_api/offers/{id}/",
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([
'name' => '<string>',
'price' => 123,
'image' => '<string>',
'units' => 1073741824,
'interval' => -1,
'recurrence_period' => -1,
'quantity_recurrences' => -1,
'trial_days' => -1,
'max_retries' => -1,
'retry_interval' => -1
]),
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;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/offers/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.cakto.com.br/public_api/offers/{id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/offers/{id}/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "5Hrb526",
"name": "Nome da Oferta",
"image": "https://example.com/image.png",
"price": 5,
"units": 1,
"default": true,
"product": "fb3fda61-e88f-43b5-982a-32d50f112414",
"status": "active",
"type": "unique",
"intervalType": "week",
"interval": 1,
"recurrence_period": 30,
"quantity_recurrences": -1,
"trial_days": 0,
"max_retries": 3,
"retry_interval": 1
}Atualizar Oferta
Atualiza uma oferta existente
curl --request PUT \
--url https://api.cakto.com.br/public_api/offers/{id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"price": 123,
"image": "<string>",
"units": 1073741824,
"interval": -1,
"recurrence_period": -1,
"quantity_recurrences": -1,
"trial_days": -1,
"max_retries": -1,
"retry_interval": -1
}
'import requests
url = "https://api.cakto.com.br/public_api/offers/{id}/"
payload = {
"name": "<string>",
"price": 123,
"image": "<string>",
"units": 1073741824,
"interval": -1,
"recurrence_period": -1,
"quantity_recurrences": -1,
"trial_days": -1,
"max_retries": -1,
"retry_interval": -1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
price: 123,
image: '<string>',
units: 1073741824,
interval: -1,
recurrence_period: -1,
quantity_recurrences: -1,
trial_days: -1,
max_retries: -1,
retry_interval: -1
})
};
fetch('https://api.cakto.com.br/public_api/offers/{id}/', 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.cakto.com.br/public_api/offers/{id}/",
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([
'name' => '<string>',
'price' => 123,
'image' => '<string>',
'units' => 1073741824,
'interval' => -1,
'recurrence_period' => -1,
'quantity_recurrences' => -1,
'trial_days' => -1,
'max_retries' => -1,
'retry_interval' => -1
]),
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;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/offers/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.cakto.com.br/public_api/offers/{id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/offers/{id}/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"price\": 123,\n \"image\": \"<string>\",\n \"units\": 1073741824,\n \"interval\": -1,\n \"recurrence_period\": -1,\n \"quantity_recurrences\": -1,\n \"trial_days\": -1,\n \"max_retries\": -1,\n \"retry_interval\": -1\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "5Hrb526",
"name": "Nome da Oferta",
"image": "https://example.com/image.png",
"price": 5,
"units": 1,
"default": true,
"product": "fb3fda61-e88f-43b5-982a-32d50f112414",
"status": "active",
"type": "unique",
"intervalType": "week",
"interval": 1,
"recurrence_period": 30,
"quantity_recurrences": -1,
"trial_days": 0,
"max_retries": 3,
"retry_interval": 1
}Escopo
write offers
Authorizations
Token de autenticação do tipo Bearer {access_token}, onde {access_token} é o token obtido no fluxo de autenticação.
Path Parameters
Id da Oferta
Body
Secure file replacement (context)
When an update replaces an existing uploaded file (e.g. a profile picture), the old file usually remains in storage unless you explicitly delete it. Over time, this leaves orphaned files and increases storage costs.
What this class does
This is an opt-in base serializer that deletes old files from storage after a
successful update that replaces (or clears) a Django models.FileField /
models.ImageField.
It is configured via Meta.delete_replaced_files_fields:
- As a list/tuple/set of field names, or
- As a dict mapping field name → options.
Supported options (per field)
delete_on_clear(bool, default True): when the update sets the field toNone/empty, delete the previous stored file.
Example usage (simple)
class UserUpdateSerializer(DeleteOldFilesMixin, serializers.ModelSerializer): # DeleteOldFilesMixin should be first that the actual serializer
class Meta:
model = User
fields = ["id", "picture", "first_name", "last_name"]
delete_replaced_files_fields = ["picture"]
Example usage (per-field options)
class DocumentUpdateSerializer(DeleteOldFilesMixin, serializers.ModelSerializer): # DeleteOldFilesMixin should be first that the actual serializer
class Meta:
model = Document
fields = ["id", "picture", "document_image"]
delete_replaced_files_fields = {
"picture": {"delete_on_clear": True},
"document_image": {"delete_on_clear": False},
}
Nome da oferta, exibido no checkout e em outros locais
255Preço da oferta
Moeda da oferta
BRL- RealEUR- EuroMXN- Peso MexicanoPEN- Sol PeruanoUSD- DólarCLP- Peso ChilenoCOP- Peso ColombianoARS- Peso ArgentinoBOB- BolivianoUYU- Peso Uruguayo
BRL, EUR, MXN, PEN, USD, CLP, COP, ARS, BOB, UYU Número de unidades que o cliente irá adquirir ao comprar esta oferta.
1 <= x <= 2147483647Status atual da oferta
active- Ativodisabled- Desabilitadodeleted- Deletado
active, disabled, deleted Tipo de pagamento da oferta (ex: unique, subscription)
unique- Pagamento únicosubscription- Assinatura recorrente
unique, subscription Tipo de intervalo do acesso concedido pela oferta (ex: month, week, lifetime)
week- Semanamonth- Mêsyear- Anolifetime- Vitalício
week, month, year, lifetime Número de intervalos que serão concedidos ao comprar esta oferta. Ex: interval=2 e intervalType=month concede 2 meses de acesso.
-2147483648 <= x <= 2147483647Número de dias entre cada cobrança da assinatura
-2147483648 <= x <= 2147483647Número de cobranças que serão feitas na assinatura. Use -1 para cobranças ilimitadas.
-2147483648 <= x <= 2147483647Número de dias de teste grátis antes da primeira cobrança
-2147483648 <= x <= 2147483647Número máximo de retentativas de cobrança em caso de falha no pagamento
-2147483648 <= x <= 2147483647Número de dias entre cada retentativa de cobrança
-2147483648 <= x <= 2147483647Response
Corpo da resposta status 200
Secure file replacement (context)
When an update replaces an existing uploaded file (e.g. a profile picture), the old file usually remains in storage unless you explicitly delete it. Over time, this leaves orphaned files and increases storage costs.
What this class does
This is an opt-in base serializer that deletes old files from storage after a
successful update that replaces (or clears) a Django models.FileField /
models.ImageField.
It is configured via Meta.delete_replaced_files_fields:
- As a list/tuple/set of field names, or
- As a dict mapping field name → options.
Supported options (per field)
delete_on_clear(bool, default True): when the update sets the field toNone/empty, delete the previous stored file.
Example usage (simple)
class UserUpdateSerializer(DeleteOldFilesMixin, serializers.ModelSerializer): # DeleteOldFilesMixin should be first that the actual serializer
class Meta:
model = User
fields = ["id", "picture", "first_name", "last_name"]
delete_replaced_files_fields = ["picture"]
Example usage (per-field options)
class DocumentUpdateSerializer(DeleteOldFilesMixin, serializers.ModelSerializer): # DeleteOldFilesMixin should be first that the actual serializer
class Meta:
model = Document
fields = ["id", "picture", "document_image"]
delete_replaced_files_fields = {
"picture": {"delete_on_clear": True},
"document_image": {"delete_on_clear": False},
}
Identificador único da oferta
Nome da oferta, exibido no checkout e em outros locais
255Preço da oferta
Indica se esta é a oferta padrão do produto
Produto ao qual esta oferta pertence
Moeda da oferta
BRL- RealEUR- EuroMXN- Peso MexicanoPEN- Sol PeruanoUSD- DólarCLP- Peso ChilenoCOP- Peso ColombianoARS- Peso ArgentinoBOB- BolivianoUYU- Peso Uruguayo
BRL, EUR, MXN, PEN, USD, CLP, COP, ARS, BOB, UYU Número de unidades que o cliente irá adquirir ao comprar esta oferta.
1 <= x <= 2147483647Status atual da oferta
active- Ativodisabled- Desabilitadodeleted- Deletado
active, disabled, deleted Tipo de pagamento da oferta (ex: unique, subscription)
unique- Pagamento únicosubscription- Assinatura recorrente
unique, subscription Tipo de intervalo do acesso concedido pela oferta (ex: month, week, lifetime)
week- Semanamonth- Mêsyear- Anolifetime- Vitalício
week, month, year, lifetime Número de intervalos que serão concedidos ao comprar esta oferta. Ex: interval=2 e intervalType=month concede 2 meses de acesso.
-2147483648 <= x <= 2147483647Número de dias entre cada cobrança da assinatura
-2147483648 <= x <= 2147483647Número de cobranças que serão feitas na assinatura. Use -1 para cobranças ilimitadas.
-2147483648 <= x <= 2147483647Número de dias de teste grátis antes da primeira cobrança
-2147483648 <= x <= 2147483647Número máximo de retentativas de cobrança em caso de falha no pagamento
-2147483648 <= x <= 2147483647Número de dias entre cada retentativa de cobrança
-2147483648 <= x <= 2147483647Was this page helpful?