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

# Validate coupon by code

> Validates a coupon server-side by code. Use `product_id` for single-product checks or `cart` with a JSON string payload for cart validation.



## OpenAPI

````yaml /openapi.json get /dev/v1/coupons/code/{code}
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/code/{code}:
    get:
      tags:
        - Coupons
      summary: Validate coupon by code
      description: >-
        Validates a coupon server-side by code. Use `product_id` for
        single-product checks or `cart` with a JSON string payload for cart
        validation.
      operationId: getDevV1CouponsCodeByCode
      parameters:
        - name: code
          in: path
          required: true
          schema:
            type: string
        - name: product_id
          in: query
          required: false
          schema:
            type: string
        - name: productId
          in: query
          required: false
          schema:
            type: string
        - name: variant_id
          in: query
          required: false
          schema:
            type: string
        - name: variantId
          in: query
          required: false
          schema:
            type: string
        - name: cart
          in: query
          required: false
          schema:
            type: string
        - name: cart_json
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - coupon
                    properties:
                      coupon:
                        type: object
                        properties:
                          id:
                            type: string
                          uniqid:
                            type: string
                          shop_id:
                            type: string
                          type:
                            type: string
                          code:
                            type: string
                          value:
                            anyOf:
                              - type: string
                              - type: number
                          used_count:
                            type: number
                          max_uses:
                            nullable: true
                            type: number
                          min_order_amount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          max_discount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_from:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_until:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          is_active:
                            type: boolean
                          created_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          updated_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                example:
                  data:
                    coupon:
                      code: save10
                      type: PERCENTAGE
                      value: '10'
            multipart/form-data:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - coupon
                    properties:
                      coupon:
                        type: object
                        properties:
                          id:
                            type: string
                          uniqid:
                            type: string
                          shop_id:
                            type: string
                          type:
                            type: string
                          code:
                            type: string
                          value:
                            anyOf:
                              - type: string
                              - type: number
                          used_count:
                            type: number
                          max_uses:
                            nullable: true
                            type: number
                          min_order_amount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          max_discount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_from:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_until:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          is_active:
                            type: boolean
                          created_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          updated_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                example:
                  data:
                    coupon:
                      code: save10
                      type: PERCENTAGE
                      value: '10'
            text/plain:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - coupon
                    properties:
                      coupon:
                        type: object
                        properties:
                          id:
                            type: string
                          uniqid:
                            type: string
                          shop_id:
                            type: string
                          type:
                            type: string
                          code:
                            type: string
                          value:
                            anyOf:
                              - type: string
                              - type: number
                          used_count:
                            type: number
                          max_uses:
                            nullable: true
                            type: number
                          min_order_amount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          max_discount:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_from:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          valid_until:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          is_active:
                            type: boolean
                          created_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                          updated_at:
                            nullable: true
                            anyOf:
                              - type: string
                              - type: number
                example:
                  data:
                    coupon:
                      code: save10
                      type: PERCENTAGE
                      value: '10'
        '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
        '500':
          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.

````