Update a coupon
curl --request PUT \
--url http://localhost:7701/api/v1/subscriptions/coupons/{uuid} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--data '
{
"name": "Updated Summer Sale",
"description": "Updated description.",
"max_redemptions": 200,
"max_cycles": 6,
"valid_until": "2026-12-31",
"is_active": false
}
'import requests
url = "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}"
payload = {
"name": "Updated Summer Sale",
"description": "Updated description.",
"max_redemptions": 200,
"max_cycles": 6,
"valid_until": "2026-12-31",
"is_active": False
}
headers = {
"x-client-id": "<x-client-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-client-id': '<x-client-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Updated Summer Sale',
description: 'Updated description.',
max_redemptions: 200,
max_cycles: 6,
valid_until: '2026-12-31',
is_active: false
})
};
fetch('http://localhost:7701/api/v1/subscriptions/coupons/{uuid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}",
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' => 'Updated Summer Sale',
'description' => 'Updated description.',
'max_redemptions' => 200,
'max_cycles' => 6,
'valid_until' => '2026-12-31',
'is_active' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-client-id: <x-client-id>"
],
]);
$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 := "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}"
payload := strings.NewReader("{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-client-id", "<x-client-id>")
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.put("http://localhost:7701/api/v1/subscriptions/coupons/{uuid}")
.header("x-client-id", "<x-client-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/subscriptions/coupons/{uuid}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["x-client-id"] = '<x-client-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "SUMMER20",
"name": "20% off Summer Sale",
"description": "<string>",
"discount_type": "percentage",
"discount_value": 20,
"max_redemptions": 100,
"redemptions_count": 5,
"max_cycles": 3,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"is_active": true,
"created_at": "2023-11-07T05:31:56Z"
}
}Coupons
Update a coupon
Updates a coupon. Code, discount_type, discount_value, and valid_from cannot be changed after creation.
PUT
/
api
/
v1
/
subscriptions
/
coupons
/
{uuid}
Update a coupon
curl --request PUT \
--url http://localhost:7701/api/v1/subscriptions/coupons/{uuid} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--data '
{
"name": "Updated Summer Sale",
"description": "Updated description.",
"max_redemptions": 200,
"max_cycles": 6,
"valid_until": "2026-12-31",
"is_active": false
}
'import requests
url = "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}"
payload = {
"name": "Updated Summer Sale",
"description": "Updated description.",
"max_redemptions": 200,
"max_cycles": 6,
"valid_until": "2026-12-31",
"is_active": False
}
headers = {
"x-client-id": "<x-client-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-client-id': '<x-client-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Updated Summer Sale',
description: 'Updated description.',
max_redemptions: 200,
max_cycles: 6,
valid_until: '2026-12-31',
is_active: false
})
};
fetch('http://localhost:7701/api/v1/subscriptions/coupons/{uuid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}",
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' => 'Updated Summer Sale',
'description' => 'Updated description.',
'max_redemptions' => 200,
'max_cycles' => 6,
'valid_until' => '2026-12-31',
'is_active' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-client-id: <x-client-id>"
],
]);
$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 := "http://localhost:7701/api/v1/subscriptions/coupons/{uuid}"
payload := strings.NewReader("{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-client-id", "<x-client-id>")
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.put("http://localhost:7701/api/v1/subscriptions/coupons/{uuid}")
.header("x-client-id", "<x-client-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/subscriptions/coupons/{uuid}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["x-client-id"] = '<x-client-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Summer Sale\",\n \"description\": \"Updated description.\",\n \"max_redemptions\": 200,\n \"max_cycles\": 6,\n \"valid_until\": \"2026-12-31\",\n \"is_active\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "SUMMER20",
"name": "20% off Summer Sale",
"description": "<string>",
"discount_type": "percentage",
"discount_value": 20,
"max_redemptions": 100,
"redemptions_count": 5,
"max_cycles": 3,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"is_active": true,
"created_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Company API key. Send in the X-API-Key header.
Headers
Client identifier for the company in the request.
Example:
"client_abc123"
Path Parameters
Body
application/json
Example:
"Updated Summer Sale"
Example:
"Updated description."
New redemption cap. Null removes the limit.
Example:
200
New per-subscription cycle cap. Null removes the limit.
Example:
6
New expiry date. Null removes the expiry.
Example:
"2026-12-31"
Set to false to deactivate and prevent new applications.
Example:
false
Response
Coupon updated
Show child attributes
Show child attributes