This endpoint requires admin authentication. Include a valid admin JWT token in the Authorization header.
Request Body
The unique name/code for the coupon (max 30 characters)
The discount percentage. Must be an integer between 1 and 100
The expiration date in ISO 8601 date string format (e.g., “2026-12-31”)
Response
Returns the created coupon object with the assigned ID.
The unique identifier for the coupon
curl -X POST https://api.example.com/coupons \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "SUMMER2026",
"percentage": 25,
"expirationDate": "2026-08-31"
}'
{
"id": 1,
"name": "SUMMER2026",
"percentage": 25,
"expirationDate": "2026-08-31"
}
Validation Rules
- name: Required, maximum 30 characters
- percentage: Required, must be an integer between 1 and 100 (inclusive)
- expirationDate: Required, must be a valid ISO 8601 date string format