Skip to main content
GET
/
coupons
/
{id}
curl -X GET https://api.example.com/coupons/1 \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"
{
  "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.

Path Parameters

id
number
required
The unique identifier of the coupon to retrieve. Must be a valid positive integer.

Response

Returns the coupon object with the specified ID.
id
number
The unique identifier for the coupon
name
string
The coupon name/code
percentage
number
The discount percentage (1-100)
expirationDate
string
The expiration date
curl -X GET https://api.example.com/coupons/1 \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"
{
  "id": 1,
  "name": "SUMMER2026",
  "percentage": 25,
  "expirationDate": "2026-08-31"
}

Validation

The ID parameter is validated using IdValidationPipe, which ensures:
  • The ID is a numeric string
  • The ID represents a valid positive integer
Invalid ID formats (e.g., negative numbers, non-numeric strings, decimals) will return a 400 Bad Request error.

Build docs developers (and LLMs) love