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

# Update Discount Code



## OpenAPI

````yaml /api-reference/openapi.json patch /api/dashboard/discount-codes/{code_id}
openapi: 3.1.0
info:
  title: Agentic Commerce API
  description: |2-

        Agentic Commerce API - E-commerce Backend

        ## APIs

        ### Dashboard API (`/api/dashboard`)
        Authenticated endpoints for merchant management:
        - Products, Variants, Options
        - Inventory management
        - Orders and fulfillment
        - Customers
        - Collections

        ### Storefront API (`/api/storefront`)
        Public endpoints for client websites:
        - Product catalog
        - Collections
        - Cart management
        - Checkout

        ### Sync API (`/api/sync`)
        Integration endpoints for zunkiree-search:
        - Product sync
        - Availability checks
        - Order creation from AI widget
        
  version: 1.0.0
servers: []
security: []
paths:
  /api/dashboard/discount-codes/{code_id}:
    patch:
      tags:
        - Dashboard
        - Discount Codes
      summary: Update Discount Code
      operationId: update_discount_code_api_dashboard_discount_codes__code_id__patch
      parameters:
        - name: code_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Code Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: X-Stella-Merchant-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Stella-Merchant-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiscountCodeUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCodeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DiscountCodeUpdate:
      properties:
        description:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Description
        value:
          anyOf:
            - type: number
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Value
        currency:
          anyOf:
            - type: string
              maxLength: 3
              minLength: 3
            - type: 'null'
          title: Currency
        min_order_amount:
          anyOf:
            - type: number
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Min Order Amount
        max_uses_total:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Uses Total
        max_uses_per_customer:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Uses Per Customer
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
      type: object
      title: DiscountCodeUpdate
    DiscountCodeResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        code:
          type: string
          title: Code
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        kind:
          type: string
          title: Kind
        value:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Value
        currency:
          anyOf:
            - type: string
            - type: 'null'
          title: Currency
        min_order_amount:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Min Order Amount
        max_uses_total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Uses Total
        max_uses_per_customer:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Uses Per Customer
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
        revoked_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Revoked At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - code
        - description
        - kind
        - value
        - currency
        - min_order_amount
        - max_uses_total
        - max_uses_per_customer
        - starts_at
        - ends_at
        - revoked_at
        - created_at
        - updated_at
      title: DiscountCodeResponse
      description: Dashboard view of a single discount code.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````