Update a coupon
curl --request PATCH \
--url https://app.papelship.com/api/v1/coupons/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-store-hash: <api-key>' \
--data '
{
"code": "SUMMER20",
"value": 123,
"max_uses": 2,
"require_purchase": true,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_ids": [
123
],
"disabled_payment_methods": [
"BITCOIN"
]
}
'const options = {
method: 'PATCH',
headers: {
'x-api-key': '<api-key>',
'x-store-hash': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: 'SUMMER20',
value: 123,
max_uses: 2,
require_purchase: true,
valid_from: '2026-10-04T12:00:00.000Z',
valid_to: '2026-10-04T12:00:00.000Z',
status: 'active',
product_ids: [123],
disabled_payment_methods: ['BITCOIN']
})
};
fetch('https://app.papelship.com/api/v1/coupons/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.papelship.com/api/v1/coupons/{id}"
payload = {
"code": "SUMMER20",
"value": 123,
"max_uses": 2,
"require_purchase": True,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_ids": [123],
"disabled_payment_methods": ["BITCOIN"]
}
headers = {
"x-api-key": "<api-key>",
"x-store-hash": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.papelship.com/api/v1/coupons/{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([
'code' => 'SUMMER20',
'value' => 123,
'max_uses' => 2,
'require_purchase' => true,
'valid_from' => '2026-10-04T12:00:00.000Z',
'valid_to' => '2026-10-04T12:00:00.000Z',
'status' => 'active',
'product_ids' => [
123
],
'disabled_payment_methods' => [
'BITCOIN'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-store-hash: <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://app.papelship.com/api/v1/coupons/{id}"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"value\": 123,\n \"max_uses\": 2,\n \"require_purchase\": true,\n \"valid_from\": \"2026-10-04T12:00:00.000Z\",\n \"valid_to\": \"2026-10-04T12:00:00.000Z\",\n \"status\": \"active\",\n \"product_ids\": [\n 123\n ],\n \"disabled_payment_methods\": [\n \"BITCOIN\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-store-hash", "<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))
}{
"success": true,
"coupon": {
"id": 35,
"object": "coupon",
"hash_id": "XcLtb99X",
"code": "SUMMER20",
"type": "percent",
"value": 20,
"max_uses": 123,
"used_count": 0,
"usage_count": 0,
"require_purchase": false,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_count": 0,
"is_all_products": true,
"disabled_payment_methods": [],
"product_ids": [
123
],
"products": [
{
"id": 123,
"hash_id": "a1B2c3D4e5F6",
"name": "Pro License",
"slug": "pro-license"
}
],
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}
}{
"success": false,
"code": "INVALID_API_KEY",
"error": "Invalid API Key",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INSUFFICIENT_SCOPE",
"error": "This API key needs the orders:write permission",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "NOT_FOUND",
"error": "Invoice not found",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INVOICE_PAID",
"error": "A paid order cannot be cancelled. Refund it instead.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "VALIDATION_FAILED",
"error": "customer_email must be a valid email address",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "RATE_LIMITED",
"error": "Too many requests. The limit is 300 requests per minute per key.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}Coupons
Update a coupon
Send only the fields to change. PUT is accepted as an alias.
Permission: coupons:write
PATCH
/
coupons
/
{id}
Update a coupon
curl --request PATCH \
--url https://app.papelship.com/api/v1/coupons/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-store-hash: <api-key>' \
--data '
{
"code": "SUMMER20",
"value": 123,
"max_uses": 2,
"require_purchase": true,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_ids": [
123
],
"disabled_payment_methods": [
"BITCOIN"
]
}
'const options = {
method: 'PATCH',
headers: {
'x-api-key': '<api-key>',
'x-store-hash': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: 'SUMMER20',
value: 123,
max_uses: 2,
require_purchase: true,
valid_from: '2026-10-04T12:00:00.000Z',
valid_to: '2026-10-04T12:00:00.000Z',
status: 'active',
product_ids: [123],
disabled_payment_methods: ['BITCOIN']
})
};
fetch('https://app.papelship.com/api/v1/coupons/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.papelship.com/api/v1/coupons/{id}"
payload = {
"code": "SUMMER20",
"value": 123,
"max_uses": 2,
"require_purchase": True,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_ids": [123],
"disabled_payment_methods": ["BITCOIN"]
}
headers = {
"x-api-key": "<api-key>",
"x-store-hash": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.papelship.com/api/v1/coupons/{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([
'code' => 'SUMMER20',
'value' => 123,
'max_uses' => 2,
'require_purchase' => true,
'valid_from' => '2026-10-04T12:00:00.000Z',
'valid_to' => '2026-10-04T12:00:00.000Z',
'status' => 'active',
'product_ids' => [
123
],
'disabled_payment_methods' => [
'BITCOIN'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-store-hash: <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://app.papelship.com/api/v1/coupons/{id}"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"value\": 123,\n \"max_uses\": 2,\n \"require_purchase\": true,\n \"valid_from\": \"2026-10-04T12:00:00.000Z\",\n \"valid_to\": \"2026-10-04T12:00:00.000Z\",\n \"status\": \"active\",\n \"product_ids\": [\n 123\n ],\n \"disabled_payment_methods\": [\n \"BITCOIN\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-store-hash", "<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))
}{
"success": true,
"coupon": {
"id": 35,
"object": "coupon",
"hash_id": "XcLtb99X",
"code": "SUMMER20",
"type": "percent",
"value": 20,
"max_uses": 123,
"used_count": 0,
"usage_count": 0,
"require_purchase": false,
"valid_from": "2026-10-04T12:00:00.000Z",
"valid_to": "2026-10-04T12:00:00.000Z",
"status": "active",
"product_count": 0,
"is_all_products": true,
"disabled_payment_methods": [],
"product_ids": [
123
],
"products": [
{
"id": 123,
"hash_id": "a1B2c3D4e5F6",
"name": "Pro License",
"slug": "pro-license"
}
],
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}
}{
"success": false,
"code": "INVALID_API_KEY",
"error": "Invalid API Key",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INSUFFICIENT_SCOPE",
"error": "This API key needs the orders:write permission",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "NOT_FOUND",
"error": "Invoice not found",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INVOICE_PAID",
"error": "A paid order cannot be cancelled. Refund it instead.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "VALIDATION_FAILED",
"error": "customer_email must be a valid email address",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "RATE_LIMITED",
"error": "Too many requests. The limit is 300 requests per minute per key.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}Authorizations
Your Store API key (pk_live_...). Create it in Developers › API keys.
The ID of the store the request is for. Shown in Developers › API keys.
Path Parameters
Coupon ID or hash ID.
Example:
"XcLtb99X"
Body
application/json
Uppercased. A–Z, 0–9, _, -.
Maximum string length:
64Example:
"SUMMER20"
Available options:
percent, fixed 1–100 for percent; minor units for fixed.
Required range:
x >= 1Example:
"2026-10-04T12:00:00.000Z"
Must be after valid_from.
Example:
"2026-10-04T12:00:00.000Z"
Available options:
active, inactive Product IDs or hash IDs of this store (max 1000). Replaces the current list; [] or null clears it.
Maximum array length:
100