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

# Put admincoupons



## OpenAPI

````yaml /openapi/openapi.yaml put /admin/coupons/{code}
openapi: 3.0.3
info:
  title: Golan Sertifikasi API
  version: 1.0.0
  description: >-
    Public REST API for Golan Sertifikasi web and mobile clients. All monetary
    values are integer IDR. Authenticate with Google ID token exchange; use the
    short-lived bearer token returned by the API.
servers:
  - url: /api/v1
security:
  - bearerAuth: []
paths:
  /admin/coupons/{code}:
    put:
      tags:
        - Commerce
      operationId: updateCoupon
      parameters:
        - name: code
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponInput'
      responses:
        '200':
          description: >-
            Coupon updated; existing pending reservations remain bound to the
            previous policy version.
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    CouponInput:
      type: object
      additionalProperties: false
      required:
        - code
        - discount_type
        - minimum_purchase_idr
        - global_usage_limit
        - per_user_usage_limit
        - eligible_product_types
        - eligible_course_ids
        - eligible_all_regular_courses
        - valid_from
        - valid_until
        - status
      description: >-
        Coupon amounts are explicit per policy. Checkout accepts one coupon for
        regular courses only, rejects combination with existing course
        discounts, rounds percentage discount down to whole IDR, and
        recalculates the tax-inclusive price snapshot.
      properties:
        code:
          type: string
          minLength: 3
          maxLength: 64
          pattern: ^[A-Za-z0-9_-]+$
        discount_type:
          type: string
          enum:
            - fixed
            - percentage
        discount_value_idr:
          type: integer
          format: int64
          minimum: 1
          description: Required only for fixed discounts.
        discount_basis_points:
          type: integer
          minimum: 1
          maximum: 10000
          description: >-
            Required only for percentage discounts; 100 basis points equals one
            percent.
        max_discount_idr:
          type: integer
          format: int64
          minimum: 1
          description: Required only for percentage discounts.
        minimum_purchase_idr:
          type: integer
          format: int64
          minimum: 0
        global_usage_limit:
          type: integer
          format: int64
          minimum: 1
        per_user_usage_limit:
          type: integer
          format: int64
          minimum: 1
        eligible_product_types:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - regular
          description: MVP permits regular courses only; BNSP is excluded.
        eligible_course_ids:
          type: array
          items:
            type: string
        eligible_all_regular_courses:
          type: boolean
          description: >-
            When true eligible_course_ids must be empty; when false it must
            contain one or more course IDs.
        valid_from:
          type: string
          format: date-time
        valid_until:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - draft
            - active
            - disabled
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - unauthorized
            - forbidden
            - invalid_google_credential
            - auth_not_configured
            - account_unavailable
            - self_referral
            - not_found
            - tax_policy_unavailable
            - finance_policy_unapproved
            - insufficient_balance
            - wallet_on_hold
            - reservation_pending
            - payment_pending
            - dependency_unavailable
            - payment_unavailable
            - push_unavailable
            - media_unavailable
            - upload_too_large
            - amount_mismatch
            - invalid_status
            - invalid_coupon
            - gateway_request_failed
            - gateway_verification_failed
            - conflict
            - invalid_request
            - idempotency_key_required
            - invalid_idempotency_key
            - internal_error
        message:
          type: string
        request_id:
          type: string
  responses:
    Forbidden:
      description: Role or resource access denied.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.