Coupons
Overview
Section titled “Overview”The Coupons resource provides fake coupon data with discount types, values, usage limits, and expiration dates.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/coupons | List all coupons |
| GET | /v1/coupons/:id | Get a specific coupon |
Coupon Object
Section titled “Coupon Object”{ "id": 1, "code": "SAVE50", "description": "50% off on all electronics", "discountType": "percentage", "discountValue": 50, "minPurchase": 100, "maxDiscount": 200, "usageLimit": 100, "usedCount": 25, "expiresAt": "2026-12-31T23:59:59.000Z", "isActive": true, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
code |
string |
Unique coupon code |
description |
string |
Coupon description |
discountType |
string |
Type (percentage or fixed) |
discountValue |
number |
Discount amount or percentage |
minPurchase |
number |
Minimum purchase amount (optional) |
maxDiscount |
number |
Maximum discount cap (optional) |
usageLimit |
number |
Max number of times coupon can be used |
usedCount |
number |
Number of times coupon has been used |
expiresAt |
string |
Expiration date (ISO 8601) |
isActive |
boolean |
Whether coupon is currently active |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Coupons
Section titled “List Coupons”curl https://api.phantomjson.app/v1/couponsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
code |
string |
— | Filter by code |
isActive |
boolean |
— | Filter by active status |
Response
Section titled “Response”{ "data": [ { "id": 1, "code": "SAVE50", "description": "50% off on all electronics", "discountType": "percentage", "discountValue": 50, "isActive": true } ], "meta": { "total": 50, "page": 1, "limit": 20, "totalPages": 3 }}Get Coupon by ID
Section titled “Get Coupon by ID”curl https://api.phantomjson.app/v1/coupons/1Response
Section titled “Response”{ "data": { "id": 1, "code": "SAVE50", "description": "50% off on all electronics", "discountType": "percentage", "discountValue": 50, "minPurchase": 100, "maxDiscount": 200, "usageLimit": 100, "usedCount": 25, "expiresAt": "2026-12-31T23:59:59.000Z", "isActive": true, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z" }}Examples
Section titled “Examples”Filter by Code
Section titled “Filter by Code”curl "https://api.phantomjson.app/v1/coupons?code=SAVE50"Filter Active Coupons
Section titled “Filter Active Coupons”curl "https://api.phantomjson.app/v1/coupons?isActive=true"Search Coupons
Section titled “Search Coupons”curl "https://api.phantomjson.app/v1/coupons?q=electronics"Sort by Discount Value
Section titled “Sort by Discount Value”curl "https://api.phantomjson.app/v1/coupons?sort=discountValue:desc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/coupons?fields=id,code,discountType,discountValue"Relations
Section titled “Relations”- Coupons are standalone resources with no relationships to other endpoints.
