Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Update a coupon

Admin or branch manager only. Patches the active flag, expiry, use cap, or description. An empty patch answers 400 and an unknown coupon 404; deactivating a coupon is a soft delete.

PUT/api/v1/coupons/{couponId}
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Path parameters
couponIdstringrequired

The coupon id.

Request body
requiredapplication/json
is_activeboolean | null
valid_untilstring | null
max_usesinteger | null
Show properties
Any of:
integer
integer
null
null
descriptionstring | null
Responses
200

Coupon updated

idstringrequired
updatedbooleanrequired
400

Nothing to update

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller is not an admin or branch manager

detailstringrequired
404

Coupon not found

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT 'http://localhost:8000/api/v1/coupons/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "is_active": true,
  "valid_until": "string",
  "max_uses": -9007199254740991,
  "description": "string"
}'
Response
{
  "id": "string",
  "updated": true
}