curl --request PATCH \
--url https://api.creem.io/v1/discounts/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Summer Sale",
"amount": 2000,
"percentage": 15,
"currency": "USD",
"expiry_date": "2026-12-31T23:59:59Z",
"max_redemptions": 100,
"duration_in_months": 6,
"applies_to_products": [
"prod_123"
],
"applies_to_product_external_ids": [
"pro-monthly"
],
"external_id": "spring-2026"
}
'import requests
url = "https://api.creem.io/v1/discounts/{id}"
payload = {
"name": "Summer Sale",
"amount": 2000,
"percentage": 15,
"currency": "USD",
"expiry_date": "2026-12-31T23:59:59Z",
"max_redemptions": 100,
"duration_in_months": 6,
"applies_to_products": ["prod_123"],
"applies_to_product_external_ids": ["pro-monthly"],
"external_id": "spring-2026"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Summer Sale',
amount: 2000,
percentage: 15,
currency: 'USD',
expiry_date: '2026-12-31T23:59:59Z',
max_redemptions: 100,
duration_in_months: 6,
applies_to_products: ['prod_123'],
applies_to_product_external_ids: ['pro-monthly'],
external_id: 'spring-2026'
})
};
fetch('https://api.creem.io/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.creem.io/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' => 'Summer Sale',
'amount' => 2000,
'percentage' => 15,
'currency' => 'USD',
'expiry_date' => '2026-12-31T23:59:59Z',
'max_redemptions' => 100,
'duration_in_months' => 6,
'applies_to_products' => [
'prod_123'
],
'applies_to_product_external_ids' => [
'pro-monthly'
],
'external_id' => 'spring-2026'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.creem.io/v1/discounts/{id}"
payload := strings.NewReader("{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.creem.io/v1/discounts/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/discounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "discount",
"status": "active",
"name": "Holiday Sale",
"code": "HOLIDAY2024",
"type": "percentage",
"external_id": "spring-2026",
"amount": 20,
"currency": "USD",
"percentage": 15,
"expiry_date": "2024-12-31T23:59:59Z",
"max_redemptions": 100,
"duration": "repeating",
"duration_in_months": 6,
"applies_to_products": [
"prod_123",
"prod_456"
],
"redeem_count": 15
}Update a discount
Update a discount. Only supplied fields change; the code never does. Once redeemed, its amount, type, currency and duration are fixed. A discount with a Stripe coupon also keeps its expiry, redemption limit and products; a name change renames the coupon.
curl --request PATCH \
--url https://api.creem.io/v1/discounts/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Summer Sale",
"amount": 2000,
"percentage": 15,
"currency": "USD",
"expiry_date": "2026-12-31T23:59:59Z",
"max_redemptions": 100,
"duration_in_months": 6,
"applies_to_products": [
"prod_123"
],
"applies_to_product_external_ids": [
"pro-monthly"
],
"external_id": "spring-2026"
}
'import requests
url = "https://api.creem.io/v1/discounts/{id}"
payload = {
"name": "Summer Sale",
"amount": 2000,
"percentage": 15,
"currency": "USD",
"expiry_date": "2026-12-31T23:59:59Z",
"max_redemptions": 100,
"duration_in_months": 6,
"applies_to_products": ["prod_123"],
"applies_to_product_external_ids": ["pro-monthly"],
"external_id": "spring-2026"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Summer Sale',
amount: 2000,
percentage: 15,
currency: 'USD',
expiry_date: '2026-12-31T23:59:59Z',
max_redemptions: 100,
duration_in_months: 6,
applies_to_products: ['prod_123'],
applies_to_product_external_ids: ['pro-monthly'],
external_id: 'spring-2026'
})
};
fetch('https://api.creem.io/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.creem.io/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' => 'Summer Sale',
'amount' => 2000,
'percentage' => 15,
'currency' => 'USD',
'expiry_date' => '2026-12-31T23:59:59Z',
'max_redemptions' => 100,
'duration_in_months' => 6,
'applies_to_products' => [
'prod_123'
],
'applies_to_product_external_ids' => [
'pro-monthly'
],
'external_id' => 'spring-2026'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.creem.io/v1/discounts/{id}"
payload := strings.NewReader("{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.creem.io/v1/discounts/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/discounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Summer Sale\",\n \"amount\": 2000,\n \"percentage\": 15,\n \"currency\": \"USD\",\n \"expiry_date\": \"2026-12-31T23:59:59Z\",\n \"max_redemptions\": 100,\n \"duration_in_months\": 6,\n \"applies_to_products\": [\n \"prod_123\"\n ],\n \"applies_to_product_external_ids\": [\n \"pro-monthly\"\n ],\n \"external_id\": \"spring-2026\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "discount",
"status": "active",
"name": "Holiday Sale",
"code": "HOLIDAY2024",
"type": "percentage",
"external_id": "spring-2026",
"amount": 20,
"currency": "USD",
"percentage": 15,
"expiry_date": "2024-12-31T23:59:59Z",
"max_redemptions": 100,
"duration": "repeating",
"duration_in_months": 6,
"applies_to_products": [
"prod_123",
"prod_456"
],
"redeem_count": 15
}Authorizations
Body
Discount update payload
The type of the discount. Fixed once the discount has been redeemed, or while a checkout confirmed with it in the last 7 days holds it (409 discount_redeemed); the same applies to amount, percentage, currency, duration and duration_in_months. Changing it needs the new amount or percentage.
percentage, fixed The number of months for a repeating discount. Fixed once the discount has been redeemed. A discount that is repeating after the update needs it: null there, or duration: repeating without months on a discount that has none, answers 400 invalid_duration_in_months.
1 <= x <= 12006
Response
Successfully updated the discount