curl --request PATCH \
--url https://api.quentli.com/v1/discounts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Buen Fin 25%",
"description": null,
"codes": [
"BUEN-FIN-2025"
],
"type": "PERCENTAGE",
"amountOff": null,
"percentageOff": 25,
"active": true,
"oneOff": false,
"expiresAt": null,
"maxApplications": null
}
'import requests
url = "https://api.quentli.com/v1/discounts/{id}"
payload = {
"name": "Buen Fin 25%",
"description": None,
"codes": ["BUEN-FIN-2025"],
"type": "PERCENTAGE",
"amountOff": None,
"percentageOff": 25,
"active": True,
"oneOff": False,
"expiresAt": None,
"maxApplications": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Buen Fin 25%',
description: null,
codes: ['BUEN-FIN-2025'],
type: 'PERCENTAGE',
amountOff: null,
percentageOff: 25,
active: true,
oneOff: false,
expiresAt: null,
maxApplications: null
})
};
fetch('https://api.quentli.com/v1/discounts/{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.quentli.com/v1/discounts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Buen Fin 25%',
'description' => null,
'codes' => [
'BUEN-FIN-2025'
],
'type' => 'PERCENTAGE',
'amountOff' => null,
'percentageOff' => 25,
'active' => true,
'oneOff' => false,
'expiresAt' => null,
'maxApplications' => null
]),
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.quentli.com/v1/discounts/{id}"
payload := strings.NewReader("{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.quentli.com/v1/discounts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quentli.com/v1/discounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}"
response = http.request(request)
puts response.read_body{
"discount": {
"id": "disc_1234567890abcdefghij",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z",
"deletedAt": null,
"name": "Buen Fin 20%",
"description": null,
"organizationId": "org_1234567890abcdefghij",
"type": "PERCENTAGE",
"amountOff": 30000,
"percentageOff": 20,
"active": true,
"oneOff": false,
"expiresAt": null,
"maxApplications": 3
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Update discount
Updates editable fields of an existing discount by id.
curl --request PATCH \
--url https://api.quentli.com/v1/discounts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Buen Fin 25%",
"description": null,
"codes": [
"BUEN-FIN-2025"
],
"type": "PERCENTAGE",
"amountOff": null,
"percentageOff": 25,
"active": true,
"oneOff": false,
"expiresAt": null,
"maxApplications": null
}
'import requests
url = "https://api.quentli.com/v1/discounts/{id}"
payload = {
"name": "Buen Fin 25%",
"description": None,
"codes": ["BUEN-FIN-2025"],
"type": "PERCENTAGE",
"amountOff": None,
"percentageOff": 25,
"active": True,
"oneOff": False,
"expiresAt": None,
"maxApplications": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Buen Fin 25%',
description: null,
codes: ['BUEN-FIN-2025'],
type: 'PERCENTAGE',
amountOff: null,
percentageOff: 25,
active: true,
oneOff: false,
expiresAt: null,
maxApplications: null
})
};
fetch('https://api.quentli.com/v1/discounts/{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.quentli.com/v1/discounts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Buen Fin 25%',
'description' => null,
'codes' => [
'BUEN-FIN-2025'
],
'type' => 'PERCENTAGE',
'amountOff' => null,
'percentageOff' => 25,
'active' => true,
'oneOff' => false,
'expiresAt' => null,
'maxApplications' => null
]),
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.quentli.com/v1/discounts/{id}"
payload := strings.NewReader("{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.quentli.com/v1/discounts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quentli.com/v1/discounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Buen Fin 25%\",\n \"description\": null,\n \"codes\": [\n \"BUEN-FIN-2025\"\n ],\n \"type\": \"PERCENTAGE\",\n \"amountOff\": null,\n \"percentageOff\": 25,\n \"active\": true,\n \"oneOff\": false,\n \"expiresAt\": null,\n \"maxApplications\": null\n}"
response = http.request(request)
puts response.read_body{
"discount": {
"id": "disc_1234567890abcdefghij",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z",
"deletedAt": null,
"name": "Buen Fin 20%",
"description": null,
"organizationId": "org_1234567890abcdefghij",
"type": "PERCENTAGE",
"amountOff": 30000,
"percentageOff": 20,
"active": true,
"oneOff": false,
"expiresAt": null,
"maxApplications": 3
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Authorizations
Organization API key using Authorization: Bearer sk_....
Path Parameters
Identifier of the discount.
Body
Request body for updating a discount. All fields are optional.
Display name of the discount.
1"Buen Fin 25%"
Optional description.
null
Replaces all existing codes with this list. Codes are uppercased automatically.
1 - 140["BUEN-FIN-2025"]
Whether the discount is a fixed amount (FIXED) or a percentage (PERCENTAGE).
FIXED, PERCENTAGE "PERCENTAGE"
Fixed discount amount in minor currency units. Required when type is FIXED.
0 <= x <= 99999999999null
Percentage to discount (0-100). Required when type is PERCENTAGE.
0 <= x <= 10025
Whether the discount is active.
true
Whether this discount is single-use.
false
Optional expiration date.
null
Maximum number of times this discount can be applied.
x >= 1null
Response
Discount updated
Updated discount.
A reusable discount that can be applied to invoices or subscriptions.
Show child attributes
Show child attributes
Was this page helpful?