Commerce · Commerce
Updates a discount. Fields you leave out keep their current values. Works with Shopify and WooCommerce accounts.
https://api.pozy.ai/v1/commerce/discounts/{discountId}Guides: Commerce & blogs, Products and catalog
Request
Send your API key as Authorization: Bearer pz_live_.... Read-only keys cannot call it. Keys with the commerce resource group disabled get 403 resource_group_disabled. Authentication
Path parameters
| Name | Type | Notes |
|---|---|---|
discountIdrequired | string |
Request body
application/json, required
accountIdstringrequiredtitlestringcodestringpercentagenumberAt most 100.
amountstringappliesOnEachItembooleanminimumSubtotalstringCan be null.
minimumQuantityintegerAt least 1. Can be null.
usageLimitintegerAt least 1. Can be null.
oncePerCustomerbooleanstartsAtstring (date-time)endsAtstring (date-time)Can be null.
Example
curl -X PATCH "https://api.pozy.ai/v1/commerce/discounts/6ebbd22404a5ebbadf66d175" \
-H "Authorization: Bearer $POZY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "696e0b682d0a31188e7a2ba9"
}'const res = await fetch("https://api.pozy.ai/v1/commerce/discounts/6ebbd22404a5ebbadf66d175", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.POZY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
accountId: "696e0b682d0a31188e7a2ba9"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);import os
import requests
resp = requests.patch(
"https://api.pozy.ai/v1/commerce/discounts/6ebbd22404a5ebbadf66d175",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
json={
"accountId": "696e0b682d0a31188e7a2ba9",
},
timeout=30,
)
resp.raise_for_status()
print(resp.json())Response
200 on success
discountobject20 child fields
idstringaccountIdstringplatformstringOne of
shopify.titlestringmethodstringOne of
code,automatic.typestringOne of
percentage,fixed_amount,free_shipping,buy_x_get_y,app.codesarray of stringcodeCountintegerCan be null.
valueobjectOne of:
Option 1 (2 fields)
typestringOne of
percentage.percentagenumber
Option 2 (3 fields)
typestringOne of
fixed_amount.amountobject2 child fields
amountstringrequiredcurrencystringrequired
appliesOnEachItemboolean
appliesToobjectCan be null.
4 child fields
typestringOne of
all,products,collections.productIdsarray of stringvariantIdsarray of stringcollectionIdsarray of string
minimumobjectCan be null.
3 child fields
typestringOne of
subtotal,quantity.amountobject2 child fields
amountstringrequiredcurrencystringrequired
quantityinteger
usageLimitintegerCan be null.
oncePerCustomerbooleanusageCountintegerstartsAtstring (date-time)endsAtstring (date-time)Can be null.
statusstringOne of
active,scheduled,expired.platformStatusstringsummarystringplatformDataobjectCan be null.
{
"discount": {
"id": "6bfebd43ddc270f6d2c56fc5",
"accountId": "696e0b682d0a31188e7a2ba9",
"platform": "shopify",
"title": "Launch day",
"method": "code",
"type": "percentage",
"codes": [
"string"
],
"codeCount": 42,
"value": {
"type": "percentage",
"percentage": 12.5
},
"appliesTo": {
"type": "all",
"productIds": [
"string"
],
"variantIds": [
"string"
],
"collectionIds": [
"string"
]
},
"minimum": {
"type": "subtotal",
"amount": {
"amount": "string",
"currency": "USD"
},
"quantity": 1
},
"usageLimit": 1,
"oncePerCustomer": true,
"usageCount": 42,
"startsAt": "2026-10-02T09:00:00.000Z",
"endsAt": "2026-10-02T09:00:00.000Z",
"status": "active",
"platformStatus": "instagram",
"summary": "string",
"platformData": {}
}
}Errors
Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:
| 400 | invalid_request_error | A parameter or body field is missing or invalid. param names it. |
| 401 | authentication_error | The API key is missing, revoked or expired. |
| 403 | permission_error | The key is read-only, scoped to other profiles, or has this resource group disabled. |
| 404 | not_found | Nothing with that id exists in your workspace. |
| 429 | rate_limit_error | Too many requests this minute. Wait for Retry-After seconds. |
Every code is listed in Errors.