Update Coupon
PATCH /api/v1/admin/coupons/{coupon_id}
Update a coupon’s active / expires_at / max_redemptions.
Uses exclude_unset=True so an omitted field is left alone while an
explicit null is applied: expires_at: null means “never
expires” and max_redemptions: null means “unlimited”, both of
which a truthiness filter would silently discard.
Args: coupon_id: The coupon to update. body: Partial update payload. user: The authenticated platform operator (injected). session: Database session.
Returns: The updated coupon.
Raises: HTTPException 404: No coupon with that id.
Authorizations
Parameters
Path Parameters
Request Body required
PATCH /api/v1/admin/coupons/{id} request body.
Every field is optional and nullable, and None is a meaningful
value for two of them (expires_at=None means “never expires”,
max_redemptions=None means “unlimited”). Callers must therefore
distinguish “absent” from “explicitly null”, which the route does via
model_dump(exclude_unset=True) — never a truthiness check.
Responses
200
Successful Response
The canonical coupon JSON shape returned by every coupon endpoint.
object
422
Validation Error