> ## 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.

# Update coupon

> Updates a coupon for the authenticated shop.



## OpenAPI

````yaml /openapi.json patch /dev/v1/coupons/{id}
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/{id}:
    patch:
      tags:
        - Coupons
      summary: Update coupon
      description: Updates a coupon for the authenticated shop.
      operationId: patchDevV1CouponsById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              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
                is_active:
                  type: boolean
              example:
                code: SAVE15
                discount_value: 15
                products_bound:
                  - prod_1
                  - prod_2
                used_count: 4
                is_active: true
          multipart/form-data:
            schema:
              type: object
              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
                is_active:
                  type: boolean
              example:
                code: SAVE15
                discount_value: 15
                products_bound:
                  - prod_1
                  - prod_2
                used_count: 4
                is_active: true
          text/plain:
            schema:
              type: object
              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
                is_active:
                  type: boolean
              example:
                code: SAVE15
                discount_value: 15
                products_bound:
                  - prod_1
                  - prod_2
                used_count: 4
                is_active: true
      responses:
        '200':
          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: save15
                    discount: 15
                    used: 4
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711936800
                    products_bound:
                      - prod_1
                      - prod_2
                    products_count: 2
            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: save15
                    discount: 15
                    used: 4
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711936800
                    products_bound:
                      - prod_1
                      - prod_2
                    products_count: 2
            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: save15
                    discount: 15
                    used: 4
                    max_uses: 100
                    min_order_amount: 20
                    max_discount: 50
                    valid_from: 1711929600
                    valid_until: 1714521600
                    is_active: true
                    created_at: 1711929600
                    updated_at: 1711936800
                    products_bound:
                      - prod_1
                      - prod_2
                    products_count: 2
        '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
        '404':
          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.

````