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

# Create Coupon

Creates a new discount coupon.

## Mutation

<CodeGroup>
  ```graphql Mutation theme={null}
  mutation CreateCoupon($input: CreateCouponInput!) {
    createOneCoupon(input: $input) {
      id
      code
      status
      type
      discountValue
      duration
      durationInMonths
      maxRedemptions
    }
  }
  ```

  ```json Variables theme={null}
  {
    "input": {
      "code": "SAVE20",
      "type": "PERCENTAGE",
      "discountValue": 20,
      "duration": "FOREVER",
      "maxRedemptions": 100
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "createOneCoupon": {
        "id": "coupon-123",
        "code": "SAVE20",
        "status": "ACTIVE",
        "type": "PERCENTAGE",
        "discountValue": 20,
        "duration": "FOREVER",
        "durationInMonths": null,
        "maxRedemptions": 100
      }
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="input" type="CreateCouponInput" required>
  Input for creating a coupon

  <Expandable title="properties">
    <ParamField body="code" type="String" required>
      Unique coupon code
    </ParamField>

    <ParamField body="type" type="CouponType" required>
      PERCENTAGE or FIXED\_AMOUNT
    </ParamField>

    <ParamField body="discountValue" type="Float" required>
      Discount amount or percentage
    </ParamField>

    <ParamField body="duration" type="CouponDuration">
      ONE\_TIME, REPEATING, or FOREVER
    </ParamField>

    <ParamField body="durationInMonths" type="Int">
      Months for REPEATING duration
    </ParamField>

    <ParamField body="maxRedemptions" type="Int">
      Maximum total uses
    </ParamField>

    <ParamField body="currency" type="Currency">
      Currency for FIXED\_AMOUNT type
    </ParamField>

    <ParamField body="environmentId" type="UUID">
      Environment ID
    </ParamField>
  </Expandable>
</ParamField>

## Examples

### Percentage Discount

```json theme={null}
{
  "input": {
    "code": "SAVE20",
    "type": "PERCENTAGE",
    "discountValue": 20,
    "duration": "FOREVER"
  }
}
```

### Fixed Amount Discount

```json theme={null}
{
  "input": {
    "code": "SAVE10",
    "type": "FIXED_AMOUNT",
    "discountValue": 10,
    "currency": "USD",
    "duration": "ONE_TIME"
  }
}
```

### Limited Duration

```json theme={null}
{
  "input": {
    "code": "TRIAL3",
    "type": "PERCENTAGE",
    "discountValue": 50,
    "duration": "REPEATING",
    "durationInMonths": 3
  }
}
```

## Related Operations

* [Set Coupon on Customer](/api-and-sdks/api-reference/mutations/set-coupon-on-customer) - Apply coupon
* [List Coupons](/api-and-sdks/api-reference/queries/list-coupons) - Query coupons
