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

# Create a Discount

> Create a new discount code for a store identified by `x-store-id`. Requires details such as `name`, `code`, `discount_type`, and `discount_amount`. Checks for code uniqueness within the store. Returns the created discount detail.



## OpenAPI

````yaml /api-reference/growth-api.json post /v1/discounts
openapi: 3.0.0
info:
  title: Growth API
  description: Comprehensive API documentation for Blink.
  version: 1.0.0
servers:
  - url: https://api.blink.store/v1
security:
  - storeIdHeader: []
paths:
  /v1/discounts:
    post:
      tags:
        - Discounts
      summary: Create a Discount
      description: >-
        Create a new discount code for a store identified by `x-store-id`.
        Requires details such as `name`, `code`, `discount_type`, and
        `discount_amount`. Checks for code uniqueness within the store. Returns
        the created discount detail.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDiscountRequest'
      responses:
        '201':
          description: Discount created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountDetails'
        '409':
          description: Conflict - A discount with this code already exists.
      security:
        - storeIdHeader: []
components:
  schemas:
    CreateDiscountRequest:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
        discount_type:
          type: string
          enum:
            - percentage
            - fixed
        discount_amount:
          type: number
        status:
          type: string
        max_redemptions:
          type: integer
        product_ids:
          type: array
          items:
            type: string
        starts_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
      required:
        - name
        - code
        - discount_type
        - discount_amount
    DiscountDetails:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        code:
          type: string
        discount_type:
          type: string
        discount_amount:
          type: number
        status:
          type: string
        max_redemptions:
          type: integer
        starts_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
        product_ids:
          type: array
          items:
            type: string
  securitySchemes:
    storeIdHeader:
      type: apiKey
      in: header
      name: x-store-id

````