Skip to main content
POST
/
v2
/
vendor
/
discounts
Create Discount
curl --request POST \
  --url https://api.puppetvendors.com/v2/vendor/discounts \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "code": "<string>",
  "title": "<string>",
  "startsAt": "<string>",
  "endsAt": "<string>",
  "customerGets": {},
  "usageLimit": 123,
  "appliesOncePerCustomer": true,
  "items": {}
}
'
V2 Alpha — This endpoint is part of the V2 API preview. Breaking changes may occur.

Overview

Create a new discount code for the authenticated vendor’s products.

Use Cases

  • Launch vendor-specific promotions
  • Automate discount creation from marketing campaigns

Request Body

code
string
required
Discount code for checkout.
title
string
required
Internal title/description.
startsAt
string
Start date (ISO 8601).
endsAt
string
End date (ISO 8601).
customerGets
object
Discount value configuration.
usageLimit
integer
Maximum total uses.
appliesOncePerCustomer
boolean
Limit to one use per customer.
items
object
Item targeting configuration.

Response

201
{
  "success": true,
  "data": {
    "discount": {
      "_id": "507f1f77bcf86cd799439011",
      "code": "VENDOR20",
      "title": "Vendor Special 20% Off",
      "status": "active",
      "createdAt": "2024-06-15T10:00:00.000Z"
    }
  }
}

Example

curl -X POST https://api.puppetvendors.com/v2/vendor/discounts \
  -H "Content-Type: application/json" \
  -H "x-access-token: YOUR_VENDOR_JWT_TOKEN" \
  -d '{
    "code": "VENDOR20",
    "title": "Vendor Special 20% Off",
    "usageLimit": 50,
    "appliesOncePerCustomer": true
  }'