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

# Enable or disable a coupon

> Change coupon status by ID. **Enable a coupon:** Only *disabled* coupons can be enabled. **Disable a coupon:** Only *not expired* coupons can be disabled.



## OpenAPI

````yaml coupons.openapi post /coupons/{couponId}/actions/toggle
openapi: 3.0.0
info:
  title: Offers - Coupons
  description: >-
    fabric Coupons are codes that shoppers can enter during checkout to receive
    discounts. These endpoints let merchants create and manage such codes.
    Coupons can be applied under the conditions set up by the merchant.
  version: 3.0.0
  x-audience: external-public
  termsOfService: https://fabric.inc/terms-of-use
  contact:
    name: Offers support
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
servers:
  - url: https://api.fabric.inc/v3
    description: Production environment
security: []
externalDocs:
  description: Find out more about Offers
  url: https://developer.fabric.inc/docs/offers-overview
paths:
  /coupons/{couponId}/actions/toggle:
    post:
      tags:
        - Coupons
      summary: Enable or disable a coupon
      description: >-
        Change coupon status by ID. **Enable a coupon:** Only *disabled* coupons
        can be enabled. **Disable a coupon:** Only *not expired* coupons can be
        disabled.
      operationId: toggleCoupon
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
        - in: path
          name: couponId
          schema:
            type: string
            example: 63b4b3d28adc8c000892a2ed
          required: true
          description: >-
            A 24-character system-generated coupon ID, generated using the
            [create coupon](/v3/api-reference/offers/coupons/create-coupon)
            endpoint.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/toggleCouponRequest'
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/toggleCouponResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/promotionDisabledError'
                  - $ref: '#/components/schemas/promotionInvalidId'
                  - $ref: '#/components/schemas/promotionActiveError'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '404':
          description: Not Found
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/promotionNotFound'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
      security:
        - AuthorizationToken: []
components:
  parameters:
    xFabricTenantId:
      in: header
      name: x-fabric-tenant-id
      schema:
        type: string
        minLength: 24
        maxLength: 24
      required: true
      example: 5f328bf0b5f328bf0b5f328b
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
    xFabricChannelId:
      in: header
      name: x-fabric-channel-id
      schema:
        type: string
        example: '12'
      description: >-
        x-fabric-channel-id identifies the sales channel where the API request
        is being made; primarily for multichannel use cases. The channel ids are
        12 corresponding to US and 13 corresponding to Canada. The default
        channel id is 12. This field is required.
    xClientId:
      in: header
      name: x-client-id
      schema:
        type: string
      required: false
      example: copilot
      description: >-
        A unique identifier obtained from
        [Copilot](/v3/platform/settings/api-apps/getting-system-app-credentials)
        for the System app in the fabric ecosystem, essential for OpenID Connect
        authentication flows.
    xFabricRequestId:
      in: header
      name: x-fabric-request-id
      description: A unique request ID.
      required: false
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  schemas:
    toggleCouponRequest:
      $ref: '#/components/schemas/togglePromotionRequest'
    toggleCouponResponse:
      allOf:
        - $ref: '#/components/schemas/couponResponse'
        - type: object
          description: The details of toggled coupons.
          properties:
            status:
              description: Coupon status
              example: DISABLED
    promotionDisabledError:
      type: object
      description: Promotion can't be activated if it's not disabled
      properties:
        type:
          description: The error code.
          type: string
          example: PROMO_NOT_IN_DISABLED_STATUS
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Promotion can't be activated if it's not DISABLED
    promotionInvalidId:
      type: object
      description: Promotion invalid ID error
      properties:
        type:
          description: The error code.
          type: string
          example: PROMO_ID_NOT_VALID
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Promotion ID isn't valid, it must be a valid object ID
    promotionActiveError:
      type: object
      description: Promotion isn't allowed to be updated when it's active
      properties:
        type:
          description: The error code.
          type: string
          example: PROMO_NOT_UPDATED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Active promotion can't be updated
    missingTenantHeader:
      type: object
      description: Tenant header is missing
      properties:
        type:
          description: The error code.
          type: string
          example: TENANT_HEADER_REQUIRED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: x-fabric-tenant-id header is required
    error400:
      type: object
      description: Bad request error
      properties:
        type:
          description: The error code.
          type: string
          example: BAD_REQUEST
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Bad request
    error401:
      type: object
      description: Unauthorized error
      properties:
        type:
          description: The error code.
          type: string
          example: UNAUTHORIZED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Invalid credentials
    promotionNotFound:
      type: object
      description: Promotion not found error
      properties:
        type:
          description: The error code.
          type: string
          example: PROMOTION_NOT_FOUND
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The promotion you entered doesn't exist
    error500:
      type: object
      description: Internal server error
      properties:
        type:
          description: The error code.
          type: string
          example: INTERNAL_SERVER_ERROR
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Internal server error
    togglePromotionRequest:
      type: object
      description: Toggle data request
      required:
        - isEnabled
      properties:
        isEnabled:
          description: |
            - `true`: Promotion is enabled.
            - `false`: Promotion is disabled.
          type: boolean
          example: false
    couponResponse:
      type: object
      description: The coupon details.
      required:
        - id
        - name
        - startAt
        - endAt
        - status
        - type
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          description: >-
            A 24-character system-generated coupon ID, generated using the
            [create coupon](/v3/api-reference/offers/coupons/create-coupon)
            endpoint.
          example: 6380e7ecb419a30009865fad
        name:
          type: string
          description: The name of the coupon.
          example: Christmas 2022 coupons
        status:
          type: string
          description: The status of the coupon.
          enum:
            - ACTIVE
            - SCHEDULED
            - DISABLED
            - EXPIRED
          example: SCHEDULED
        startAt:
          type: string
          format: date-time
          description: >-
            The timestamp in UTC format indicating when the coupon becomes
            valid.
          example: '2022-08-24T14:15:22.000Z'
        endAt:
          type: string
          format: date-time
          description: >-
            The timestamp in UTC format indicating when the coupon expires and
            is no longer valid.
          example: '2019-08-25T14:15:22.000Z'
        type:
          type: string
          description: >
            The type of coupon promotion you want to create. The following are
            the coupon promotion types you can create:

            - `PRODUCT`: A SKU coupon promotion. Applies a discount to SKUs
            based on the value specified in the `discount` object of the request
            body.

            - `CART`: A cart coupon promotion. Applies a discount to the minimum
            order amount of the cart based on the `ORDER_VALUE` specified in the
            `condition` object of the request body.

            - `QUANTITY`: A quantity coupon promotion. Provides discounts on
            items based on the quantity requirement set in the promotion.

            - `SHIPPING`: A shipping coupon promotion. Provides discounts on the
            shipping cost.

            - `BUYGET`: A BuyGet coupon promotion. Specifies the _Buy_
            conditions and corresponding _Get_ discounts.

            - `SPEND_GET`: A SpendGet coupon promotion. Specifies the total
            order value required to qualify for discounts and the applicable
            discounts based on the order value.
          enum:
            - PRODUCT
            - CART
            - QUANTITY
            - SHIPPING
            - BUYGET
            - SPEND_GET
          example: PRODUCT
        couponCodesCount:
          type: integer
          format: int32
          example: 100
          description: The total number of coupon codes.
        createdAt:
          $ref: '#/components/schemas/createdAt'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
        level:
          type: integer
          format: int32
          minimum: 0
          maximum: 5
          description: Coupon execution order
          example: 3
        stackingType:
          type: string
          description: >-
            Defines the rules for how a promotion can be combined with other
            promotions. This field determines whether a specific promotion can
            be applied in conjunction with other active promotions during a
            transaction or if it must be used exclusively. If configured,
            `stackingType` will have precedence over the `isStackable` and
            `isAlwaysApplied` Possible values: - `STACKABLE`: This promotion can
            be combined with other stackable promotions, allowing multiple
              discounts to be applied together. The order in which stackable promotions are applied
              is determined by the `level` field, with promotions having a higher priority (lower numeric value)
              being applied before those with a lower priority.
            - `EXCLUSIVE`: This promotion can't be combined with any other
            promotions. The `level` field is
              used to determine which exclusive promotion will be evaluated and applied first. Once an exclusive
              promotion is applied, no other promotions can be used in the same transaction.
            - `TYPE_EXCLUSIVE`: This promotion can't be combined with other
            promotions of the same type.
              The `level` field is used to determine which promotion within the same type will be evaluated and
              applied first.
            - `UNIVERSAL`: This promotion can be combined with any other
            promotions without restrictions.
              Universal promotions will be evaluated last.
          enum:
            - STACKABLE
            - EXCLUSIVE
            - TYPE_EXCLUSIVE
            - UNIVERSAL
          example: STACKABLE
        isStackable:
          type: boolean
          example: false
          description: >
            - `true`: Allows the coupon to be stacked so it can be applied with
            other coupons.

            - `false`: Disables coupon stacking.
        isAlwaysApplied:
          type: boolean
          example: false
          description: >-
            Set `true` to always apply the promotion, even on non-stackable
            promotions, or `false` to apply promotion based on configured
            conditions.
        singleMultiUse:
          type: string
          example: MULTI_USE
          description: >
            Determines whether the coupon is valid for single use or for
            multiple uses. The options are:

            - `SINGLE_USE`: The coupon can be used only once.

            - `MULTI_USE`: The coupon can be used multiple times.
          enum:
            - MULTI_USE
            - SINGLE_USE
        couponCodes:
          type: array
          description: An array containing available coupon codes.
          example:
            - SUMMER1000001
          items:
            type: string
        promotionMessages:
          $ref: '#/components/schemas/promotionMessages'
        additionalAttributes:
          type: array
          description: A placeholder for additional attributes, in name-values pairs.
          items:
            type: object
            description: Details of additional attributes.
            required:
              - name
              - values
            properties:
              name:
                type: string
                description: The attribute name.
                example: type
              values:
                description: The attribute value or values corresponding to the `name`.
                oneOf:
                  - type: string
                    description: The value of the additional attribute.
                    example: Birthday
                  - type: array
                    items:
                      type: string
                      description: The values of the additional attributes.
                      example:
                        - Birthday
                        - Holiday
              attributeId:
                type: number
                description: A unique identifier of the attribute, for external use.
                example: 100000
    createdAt:
      type: string
      format: date-time
      description: The timestamp in UTC format indicating when the coupon was created.
      example: '2019-08-20T14:15:22.000Z'
    updatedAt:
      type: string
      format: date-time
      description: The timestamp in UTC format indicating when the coupon was last updated.
      example: '2019-08-20T14:15:22.000Z'
    promotionMessages:
      type: array
      description: Message description for the promotion
      required:
        - title
        - locales
        - pages
      items:
        type: object
        description: Message description for the promotion
        properties:
          title:
            type: string
            description: Message name
            example: Buy 2 get 1 free
          message:
            type: string
            description: Message description
            example: Offer valid at participating stores through September 5, 2023.
          pages:
            type: array
            description: The types of web pages where the message is displayed.
            items:
              type: string
              description: Page type
              example: PDP
            example:
              - PDP
              - Cart
          locales:
            type: array
            description: >-
              The locales in which the promotion message is displayed. Locale is
              a set of language or country-based preferences for user interface.
            items:
              type: string
              description: Locale
              example: en-CA
            example:
              - en-CA
              - fr-CA
  headers:
    xFabricRequestIdResponse:
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  securitySchemes:
    AuthorizationToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````