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

# Create coupon

> Creates a coupon for the authenticated shop.



## OpenAPI

````yaml /openapi.json post /dev/v1/coupons
openapi: 3.0.3
info:
  title: Shoppex Developer API
  description: Mintlify-compatible Developer API reference for Shoppex.
  version: 1.0.0
  contact:
    name: Shoppex Support
    email: support@shoppex.io
    url: https://shoppex.io
servers:
  - url: https://api.shoppex.io
security:
  - bearerAuth: []
paths:
  /dev/v1/coupons:
    post:
      tags:
        - Coupons
      summary: Create coupon
      description: Creates a coupon for the authenticated shop.
      operationId: postDevV1Coupons
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
                - discount_value
              properties:
                code:
                  type: string
                  minLength: 1
                  maxLength: 64
                discount_value:
                  type: number
                  minimum: 1.e-9
                discount_type:
                  anyOf:
                    - type: string
                      enum:
                        - PERCENTAGE
                    - type: string
                      enum:
                        - FIXED
                max_uses:
                  nullable: true
                  anyOf:
                    - type: string
                      format: integer
                      default: 0
                    - type: integer
                products_bound:
                  type: array
                  items:
                    type: string
                variants_bound:
                  type: array
                  items:
                    type: string
                min_order_amount:
                  nullable: true
                  type: number
                max_discount:
                  nullable: true
                  type: number
                valid_from:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
                valid_until:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
              example:
                code: SAVE10
                discount_value: 10
                discount_type: PERCENTAGE
                max_uses: 100
                products_bound:
                  - prod_1
                min_order_amount: 20
                max_discount: 50
                valid_from: '2026-04-01T00:00:00.000Z'
                valid_until: '2026-05-01T00:00:00.000Z'
          multipart/form-data:
            schema:
              type: object
              required:
                - code
                - discount_value
              properties:
                code:
                  type: string
                  minLength: 1
                  maxLength: 64
                discount_value:
                  type: number
                  minimum: 1.e-9
                discount_type:
                  anyOf:
                    - type: string
                      enum:
                        - PERCENTAGE
                    - type: string
                      enum:
                        - FIXED
                max_uses:
                  nullable: true
                  anyOf:
                    - type: string
                      format: integer
                      default: 0
                    - type: integer
                products_bound:
                  type: array
                  items:
                    type: string
                variants_bound:
                  type: array
                  items:
                    type: string
                min_order_amount:
                  nullable: true
                  type: number
                max_discount:
                  nullable: true
                  type: number
                valid_from:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
                valid_until:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
              example:
                code: SAVE10
                discount_value: 10
                discount_type: PERCENTAGE
                max_uses: 100
                products_bound:
                  - prod_1
                min_order_amount: 20
                max_discount: 50
                valid_from: '2026-04-01T00:00:00.000Z'
                valid_until: '2026-05-01T00:00:00.000Z'
          text/plain:
            schema:
              type: object
              required:
                - code
                - discount_value
              properties:
                code:
                  type: string
                  minLength: 1
                  maxLength: 64
                discount_value:
                  type: number
                  minimum: 1.e-9
                discount_type:
                  anyOf:
                    - type: string
                      enum:
                        - PERCENTAGE
                    - type: string
                      enum:
                        - FIXED
                max_uses:
                  nullable: true
                  anyOf:
                    - type: string
                      format: integer
                      default: 0
                    - type: integer
                products_bound:
                  type: array
                  items:
                    type: string
                variants_bound:
                  type: array
                  items:
                    type: string
                min_order_amount:
                  nullable: true
                  type: number
                max_discount:
                  nullable: true
                  type: number
                valid_from:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
                valid_until:
                  nullable: true
                  anyOf:
                    - type: string
                    - type: number
              example:
                code: SAVE10
                discount_value: 10
                discount_type: PERCENTAGE
                max_uses: 100
                products_bound:
                  - prod_1
                min_order_amount: 20
                max_discount: 50
                valid_from: '2026-04-01T00:00:00.000Z'
                valid_until: '2026-05-01T00:00:00.000Z'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - type
                      - code
                      - discount
                      - used
                      - max_uses
                      - min_order_amount
                      - max_discount
                      - valid_from
                      - valid_until
                      - is_active
                      - created_at
                      - updated_at
                      - products_bound
                      - products_count
                      - variants_bound
                      - variants_count
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - PERCENTAGE
                          - type: string
                            enum:
                              - FIXED
                      code:
                        type: string
                      discount:
                        type: number
                      used:
                        type: number
                      max_uses:
                        nullable: true
                        type: number
                      min_order_amount:
                        nullable: true
                        type: number
                      max_discount:
                        nullable: true
                        type: number
                      valid_from:
                        nullable: true
                        type: number
                      valid_until:
                        nullable: true
                        type: number
                      is_active:
                        type: boolean
                      created_at:
                        type: number
                      updated_at:
                        type: number
                      products_bound:
                        type: array
                        items:
                          type: string
                      products_count:
                        type: number
                      variants_bound:
                        type: array
                        items:
                          type: string
                      variants_count:
                        type: number
                example:
                  data:
                    id: coupon_db_1
                    uniqid: coupon_1
                    shop_id: shop_1
                    type: PERCENTAGE
                    code: save10
                    discount: 10
                    used: 0
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711929600
                    products_bound:
                      - prod_1
                    products_count: 1
            multipart/form-data:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - type
                      - code
                      - discount
                      - used
                      - max_uses
                      - min_order_amount
                      - max_discount
                      - valid_from
                      - valid_until
                      - is_active
                      - created_at
                      - updated_at
                      - products_bound
                      - products_count
                      - variants_bound
                      - variants_count
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - PERCENTAGE
                          - type: string
                            enum:
                              - FIXED
                      code:
                        type: string
                      discount:
                        type: number
                      used:
                        type: number
                      max_uses:
                        nullable: true
                        type: number
                      min_order_amount:
                        nullable: true
                        type: number
                      max_discount:
                        nullable: true
                        type: number
                      valid_from:
                        nullable: true
                        type: number
                      valid_until:
                        nullable: true
                        type: number
                      is_active:
                        type: boolean
                      created_at:
                        type: number
                      updated_at:
                        type: number
                      products_bound:
                        type: array
                        items:
                          type: string
                      products_count:
                        type: number
                      variants_bound:
                        type: array
                        items:
                          type: string
                      variants_count:
                        type: number
                example:
                  data:
                    id: coupon_db_1
                    uniqid: coupon_1
                    shop_id: shop_1
                    type: PERCENTAGE
                    code: save10
                    discount: 10
                    used: 0
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711929600
                    products_bound:
                      - prod_1
                    products_count: 1
            text/plain:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - type
                      - code
                      - discount
                      - used
                      - max_uses
                      - min_order_amount
                      - max_discount
                      - valid_from
                      - valid_until
                      - is_active
                      - created_at
                      - updated_at
                      - products_bound
                      - products_count
                      - variants_bound
                      - variants_count
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - PERCENTAGE
                          - type: string
                            enum:
                              - FIXED
                      code:
                        type: string
                      discount:
                        type: number
                      used:
                        type: number
                      max_uses:
                        nullable: true
                        type: number
                      min_order_amount:
                        nullable: true
                        type: number
                      max_discount:
                        nullable: true
                        type: number
                      valid_from:
                        nullable: true
                        type: number
                      valid_until:
                        nullable: true
                        type: number
                      is_active:
                        type: boolean
                      created_at:
                        type: number
                      updated_at:
                        type: number
                      products_bound:
                        type: array
                        items:
                          type: string
                      products_count:
                        type: number
                      variants_bound:
                        type: array
                        items:
                          type: string
                      variants_count:
                        type: number
                example:
                  data:
                    id: coupon_db_1
                    uniqid: coupon_1
                    shop_id: shop_1
                    type: PERCENTAGE
                    code: save10
                    discount: 10
                    used: 0
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711929600
                    products_bound:
                      - prod_1
                    products_count: 1
        '401':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '403':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '422':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '429':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
      deprecated: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use your Shoppex API key in the Authorization header.

````