Update coupon
Change a coupon (only the keys sent)
https://s.zo.sa/api/public/v1 /coupons/{id} marketing.read_writeIdempotency-Key supportedproduct_ids, category_ids and payment_methods replace the saved list when sent: send the whole list. Every key you do not send stays.
Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | required | At least 1 |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | 1 to 120 visible ASCII characters. A write sent again with the same key runs once; the retry gets the first answer back with the header Idempotent-Replayed: true. Use a new key for each new write. 1 to 120 characters |
Request body
A coupon to create (POST: code, type and value required) or change (PATCH: only the keys sent change). The same rules as the dashboard's coupons page.
codestringUnique in the store; saved in capitals.typestringvalueintegerA whole percent (at most 100) for percent; halalas for fixed.min_subtotalintegernullableHalalas.max_discountintegernullableHalalas.free_shippingbooleanusage_limitintegernullableper_customer_limitintegernullablestarts_atstring (date)nullableThe coupon works from the start of this day in Riyadh.ends_atstring (date)nullableUntil the last second of this day in Riyadh; not before starts_at.is_activebooleanAn expired coupon is switched back on only with an ends_at still ahead.applies_tostringproducts needs product_ids, categories needs category_ids.product_idsarray of integersnullableProducts of this store.category_idsarray of integersnullableCategories of this store.exclude_sale_itemsbooleanpayment_methodsarray of stringsnullablePayment method codes the coupon is limited to.first_order_onlybooleanexclude_walletbooleanshow_in_cartbooleannotestringnullable
cURL
curl -sS -X PATCH "https://s.zo.sa/api/public/v1/coupons/9" \
-H "Authorization: Bearer $ZO_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: erp-coupon-9-limit" \
-d '{
"usage_limit": 200
}'JavaScript
const response = await fetch('https://s.zo.sa/api/public/v1/coupons/9', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.ZO_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'Idempotency-Key': 'erp-coupon-9-limit',
},
body: JSON.stringify({
"usage_limit": 200
}),
});
console.log(response.status, await response.json());PHP
<?php
$ch = curl_init('https://s.zo.sa/api/public/v1/coupons/9');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZO_API_KEY'),
'Accept: application/json',
'Content-Type: application/json',
'Idempotency-Key: erp-coupon-9-limit',
],
CURLOPT_POSTFIELDS => json_encode([
'usage_limit' => 200,
]),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL, $body, PHP_EOL;Python
import os
import requests
response = requests.patch(
"https://s.zo.sa/api/public/v1/coupons/9",
headers={
"Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
"Accept": "application/json",
"Idempotency-Key": "erp-coupon-9-limit",
},
json={
"usage_limit": 200,
},
timeout=30,
)
print(response.status_code, response.json())Caps the coupon at 200 uses; nothing else changes.
{
"data": {
"id": 1,
"code": "string",
"type": "percent",
"value": 10,
"min_subtotal": null,
"max_discount": null,
"free_shipping": false,
"usage_limit": null,
"per_customer_limit": null,
"uses": 1,
"starts_at": null,
"ends_at": null,
"is_active": true,
"status": "active",
"created_at": "2026-11-23T06:01:53Z",
"updated_at": "2026-11-23T06:01:53Z"
}
}Example generated from the schema.
Responses
Response schema
dataobjectrequired16 fields
idintegerrequiredcodestringrequiredtypestringrequiredvalueintegerrequiredA whole percent for type percent; halalas for type fixed.min_subtotalintegerrequirednullableHalalas.max_discountintegerrequirednullableHalalas.free_shippingbooleanrequiredusage_limitintegerrequirednullableper_customer_limitintegerrequirednullableusesintegerrequiredHow many times the coupon was used.starts_atstring (date-time)requirednullableends_atstring (date-time)requirednullableis_activebooleanrequiredstatusstringrequiredcreated_atstring (date-time)requiredupdated_atstring (date-time)required
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.