V2 Alpha — This endpoint is part of the V2 API preview. Breaking changes may occur.
Overview
Retrieve a paginated list of discount codes. Both merchant and vendor tokens are accepted. Merchant tokens must provide a vendorId to scope the results. Vendor tokens are automatically scoped to discounts belonging to the authenticated vendor.
Use Cases
- Manage promotions across vendors from a merchant dashboard
- Monitor discount usage and effectiveness
- Sync discount data to external marketing platforms
Query Parameters
Filter by vendor ObjectId. Required for merchant tokens; auto-filled for vendor tokens.
Filter by status. One of: active, expired, disabled.
Search in discount title and code (max 200 characters).
Number of items to return, forward pagination (1–100).
Cursor for forward pagination.
Number of items to return, backward pagination (1–100).
Cursor for backward pagination.
Response
{
"success": true,
"data": {
"edges": [
{
"node": {
"_id": "507f1f77bcf86cd799439011",
"code": "SUMMER20",
"title": "Summer Sale 20% Off",
"status": "active",
"startsAt": "2024-06-01T00:00:00.000Z",
"endsAt": "2024-08-31T23:59:59.000Z",
"usageCount": 42,
"usageLimit": 200,
"appliesOncePerCustomer": true,
"customerGets": {
"percentage": 20
}
},
"cursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9"
}
],
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9",
"endCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9"
}
}
}
Example
curl -X GET "https://api.puppetvendors.com/v2/discounts?vendorId=507f1f77bcf86cd799439011&status=active&first=20" \
-H "x-access-token: YOUR_JWT_TOKEN"