{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/noderings-com/json-schema/noderings-com-v1-create-coupon-request-schema.json",
  "title": "v1CreateCouponRequest",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/noderings-com-openapi.json#/components/schemas/v1CreateCouponRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "discountType": {
      "$ref": "#/$defs/v1CouponDiscountType"
    },
    "percentOff": {
      "type": "string"
    },
    "amountsOff": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "maxDiscountAmounts": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "appliesTo": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "usageMetricCodes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "assetCategories": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "assetTypes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "planIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "duration": {
      "$ref": "#/$defs/v1CouponDuration"
    },
    "durationInPeriods": {
      "type": "integer",
      "format": "int32"
    },
    "durationDays": {
      "type": "integer",
      "format": "int32"
    },
    "validFrom": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time",
      "description": "Defaults to the configured validity window unless no_expiry is set."
    },
    "noExpiry": {
      "type": "boolean"
    },
    "maxRedemptions": {
      "type": "integer",
      "format": "int32"
    },
    "oncePerCustomer": {
      "type": "boolean",
      "description": "Defaults to true."
    },
    "firstTimeCustomerOnly": {
      "type": "boolean"
    },
    "acknowledgeHighRisk": {
      "type": "boolean",
      "description": "Required when the terms are effectively free or unlimited."
    },
    "code": {
      "type": "string",
      "description": "Optional first shared code created with the coupon."
    },
    "creditValidDays": {
      "type": "integer",
      "format": "int32",
      "description": "Lot lifetime after a credit code is redeemed. Defaults to 90."
    }
  },
  "$defs": {
    "v1CouponDiscountType": {
      "type": "string",
      "enum": [
        "COUPON_DISCOUNT_TYPE_UNSPECIFIED",
        "COUPON_DISCOUNT_TYPE_PERCENTAGE",
        "COUPON_DISCOUNT_TYPE_FIXED",
        "COUPON_DISCOUNT_TYPE_CREDIT"
      ],
      "default": "COUPON_DISCOUNT_TYPE_UNSPECIFIED",
      "description": " - COUPON_DISCOUNT_TYPE_CREDIT: A code that grants promotional credit instead of discounting a subscription."
    },
    "v1CouponDuration": {
      "type": "string",
      "enum": [
        "COUPON_DURATION_UNSPECIFIED",
        "COUPON_DURATION_ONCE",
        "COUPON_DURATION_REPEATING",
        "COUPON_DURATION_FOREVER"
      ],
      "default": "COUPON_DURATION_UNSPECIFIED",
      "description": " - COUPON_DURATION_ONCE: Discounts the next invoice only.\n - COUPON_DURATION_REPEATING: Discounts duration_in_periods invoices, or every invoice for duration_days."
    }
  }
}