> ## Documentation Index
> Fetch the complete documentation index at: https://dev.puppetvendors.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Discount

> Create a new discount code as a vendor

<Note>
  **V2 Alpha** — This endpoint is part of the V2 API preview. Breaking changes may occur.
</Note>

## 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

<ParamField body="code" type="string" required>
  Discount code for checkout.
</ParamField>

<ParamField body="title" type="string" required>
  Internal title/description.
</ParamField>

<ParamField body="startsAt" type="string">
  Start date (ISO 8601).
</ParamField>

<ParamField body="endsAt" type="string">
  End date (ISO 8601).
</ParamField>

<ParamField body="customerGets" type="object">
  Discount value configuration.
</ParamField>

<ParamField body="usageLimit" type="integer">
  Maximum total uses.
</ParamField>

<ParamField body="appliesOncePerCustomer" type="boolean">
  Limit to one use per customer.
</ParamField>

<ParamField body="items" type="object">
  Item targeting configuration.
</ParamField>

## Response

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

## Example

```bash theme={null}
curl -X POST https://staging-api.puppetvendors.com/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
  }'
```

### More Examples

**20% off discount with limit**

```bash theme={null}
curl -X POST "https://staging-api.puppetvendors.com/discounts" \
  -H "Content-Type: application/json" \
  -H "x-access-token: YOUR_VENDOR_JWT_TOKEN" \
  -d '{
    "code": "SUMMER20",
    "title": "Summer 20% Off",
    "customerGets": {
      "value": { "type": "percentage", "value": 20 }
    },
    "usageLimit": 100,
    "appliesOncePerCustomer": true,
    "startsAt": "2026-06-01T00:00:00Z",
    "endsAt": "2026-08-31T23:59:59Z"
  }'
```

**Fixed amount discount**

```bash theme={null}
curl -X POST "https://staging-api.puppetvendors.com/discounts" \
  -H "Content-Type: application/json" \
  -H "x-access-token: YOUR_VENDOR_JWT_TOKEN" \
  -d '{
    "code": "SAVE10",
    "title": "$10 Off Any Order",
    "customerGets": {
      "value": { "type": "fixed_amount", "value": 10 }
    }
  }'
```
