Update a coupon
Changes what its codes give, in the platform too. An imported coupon changes its name, validity and reissue only (what its codes give is set where they came from). A new validity in days applies to codes handed out from now on; a new end date to every code. A bulk coupon’s quantity can grow (422 `invalid_quantity` when it shrinks). The store, kind and prefix stay.
Changes what its codes give, in the platform too. An imported coupon changes its name, validity and reissue only (what its codes give is set where they came from). A new validity in days applies to codes handed out from now on; a new end date to every code. A bulk coupon’s quantity can grow (422 invalid_quantity when it shrinks). The store, kind and prefix stay.
apiKey writeAuthorizationBearer <token>A workspace API key (pf_…), created under Developers → API keys.
Scope: write
id*stringuuididempotency-key?stringRun this write once: a retry with the same key gets the first answer (24 hours).
1 <= length <= 255application/json- body
name*string1 <= length <= 100valueType?string"percentage""amount"value?integer1 <= valueminimumSubtotal?|1 <= valuevalidity*||combinesWith?|nullreissue*string"after_use_or_expiry""every_email"quantity*|1 <= value <= 500000OK
application/json- response
id*stringuuidstore*name*stringsource*string"platform""import"kind*string"personal""bulk"quantity*integer|nullprefix*string|nullvalueType*|"percentage""amount"nullvalue*integer|nullminimumSubtotal*validity*||combinesWith*|nullreissue*string"after_use_or_expiry""every_email"status*string"active""ended""archived"externalId*string|nulladminUrl*|uriimportSkipped*integer|nullcodes*createdAt*stringdate-timearchivedAt*|date-timecurl -X PATCH 'https://api.postforge.dev/v1/coupons/497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "validity": { "type": "days", "days": 1 }, "reissue": "after_use_or_expiry", "quantity": 1}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "store": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "platform": "string", "currency": "string" }, "name": "string", "source": "platform", "kind": "personal", "quantity": 0, "prefix": "string", "valueType": "percentage", "value": 0, "minimumSubtotal": { "amount": 0, "currency": "str" }, "validity": { "type": "days", "days": 1 }, "combinesWith": { "orderDiscounts": true, "productDiscounts": true, "shippingDiscounts": true }, "reissue": "after_use_or_expiry", "status": "active", "externalId": "string", "adminUrl": "http://example.com", "importSkipped": 0, "codes": { "available": 0, "assigned": 0, "used": 0, "expired": 0, "pending": 0, "failed": 0 }, "createdAt": "2019-08-24T14:15:22Z", "archivedAt": "2019-08-24T14:15:22Z"}