{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentaos-ai/json-schema/agentaos-ai-create-discount-code-request-schema.json",
  "title": "CreateDiscountCodeRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentaos-ai-discount-codes-api-openapi.yml#/components/schemas/CreateDiscountCodeRequest",
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,64}$",
      "description": "What the buyer types. Letters, numbers, dashes and underscores."
    },
    "name": {
      "type": "string",
      "maxLength": 120,
      "description": "Your own label for the code, shown back to you on the single-code route. Not allowed on a code that carries no discount."
    },
    "percentOff": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 99,
      "description": "Percentage off the first invoice. A code cannot take the whole price off — set up a free trial for that."
    },
    "amountOffMinor": {
      "type": "integer",
      "minimum": 1,
      "description": "Integer minor units. The currency is the plan's, or your settlement currency when the code is not tied to a plan. It comes off the total the buyer pays, VAT included."
    },
    "maxRedemptions": {
      "type": "integer",
      "minimum": 1
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "Must be in the future."
    },
    "linkId": {
      "type": "string",
      "format": "uuid",
      "description": "Restrict the code to one subscription plan."
    }
  },
  "required": [
    "code"
  ]
}