Skip to main content
POST
/
coupons
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"
}
This endpoint requires admin authentication. Include a valid admin JWT token in the Authorization header.

Request Body

name
string
required
The unique name/code for the coupon (max 30 characters)
percentage
number
required
The discount percentage. Must be an integer between 1 and 100
expirationDate
string
required
The expiration date in ISO 8601 date string format (e.g., “2026-12-31”)

Response

Returns the created coupon object with the assigned ID.
id
number
The unique identifier for the coupon
name
string
The coupon name/code
percentage
number
The discount percentage
expirationDate
string
The expiration date
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

Build docs developers (and LLMs) love