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

# Search for coupons

> Use this endpoint to search for coupons based on filter conditions.



## OpenAPI

````yaml coupons.openapi post /coupons/search
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/search:
    post:
      tags:
        - Coupons
      summary: Search for coupons
      description: Use this endpoint to search for coupons based on filter conditions.
      operationId: searchCoupons
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/searchPromotionRequest'
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/searchPromotionResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/error400'
                  - $ref: '#/components/schemas/invalidSearchFilterField'
                  - $ref: '#/components/schemas/invalidPromoState'
                  - $ref: '#/components/schemas/invalidFilterOperator'
                  - $ref: '#/components/schemas/invalidPromoStackingType'
                  - $ref: '#/components/schemas/missingTenantHeader'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '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:
    searchPromotionRequest:
      type: object
      description: The search criteria.
      properties:
        size:
          type: number
          default: 10
          minimum: 1
          maximum: 100
          description: The maximum number of records per page.
          example: 10
        offset:
          type: integer
          format: int32
          example: 10
          minimum: 0
          default: 0
          description: >-
            The number of records to skip before returning records. For example,
            with an offset of 20 and limit of 10, you will get records from 21
            to 30.
        sort:
          type: string
          description: >-
            The criteria to sort the results. Use the format {sort order}{field
            name}, where `-` refers to a descending order and `+` refers to an
            ascending order.
          enum:
            - +updatedAt
            - +name
            - +startAt
            - +endAt
            - +level
            - '-updatedAt'
            - '-name'
            - '-startAt'
            - '-endAt'
            - '-level'
        filters:
          type: array
          items:
            type: object
            maxItems: 20
            required:
              - field
              - value
              - operator
            description: The filter conditions.
            properties:
              field:
                type: string
                description: The name of the field. This is always paired with `value`.
                minLength: 3
                maxLength: 120
                example: name
              value:
                description: >-
                  The value or values corresponding to the `field`. This is
                  always paired with `field`.
                oneOf:
                  - type: string
                    minLength: 1
                    maxLength: 120
                    example: Summer
                  - type: array
                    minItems: 1
                    maxItems: 10
                    items:
                      description: Search multiple values in the same field.
                      oneOf:
                        - type: string
                          example: collectionId
                        - type: number
                          example: 100000234
                        - type: object
                          properties:
                            name:
                              type: string
                              description: >-
                                The name to search. This is used to search based
                                on segments or additional attributes.
                              minLength: 1
                              maxLength: 120
                              example: Season
                            value:
                              description: >-
                                The value corresponding to the `name`. This is
                                used to search based on segments or additional
                                attributes.
                              oneOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 120
                                  example: Winter
                                - type: boolean
                                  example: true
                                - type: number
                                  example: 111
              operator:
                type: string
                description: >-
                  The type of search operation. You can use multiple values,
                  separated by commas, for the IN operation; however, you can
                  only use a single value for the EQUALS,
                  GREATER_THAN_OR_EQUAL_TO, and LESS_THAN operations.
                enum:
                  - EQUAL
                  - GREATER_THAN_OR_EQUAL_TO
                  - LESS_THAN
                  - IN
                example: EQUAL
    searchPromotionResponse:
      type: object
      description: The search results including the pagination data.
      properties:
        query:
          $ref: '#/components/schemas/offsetQuery'
        data:
          description: The response of the search request.
          type: array
          items:
            $ref: '#/components/schemas/promoSearchObject'
    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
    invalidSearchFilterField:
      type: object
      description: An error indicating an invalid search.
      properties:
        type:
          description: The error code.
          type: string
          example: INVALID_SEARCH_FILTER_FIELD
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The search filter field isn't valid.
    invalidPromoState:
      type: object
      description: An error indicating that the state of the promotion is invalid.
      properties:
        type:
          description: The error code.
          type: string
          example: INVALID_PROMO_STATE
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The promotion state isn't valid.
    invalidFilterOperator:
      type: object
      description: An error code indicating the filter operation is invalid
      properties:
        type:
          description: The error code.
          type: string
          example: INVALID_FILTER_OPERATOR
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The search filter operator isn't valid.
    invalidPromoStackingType:
      type: object
      description: An error indicating the type of promotion stacking is invalid.
      properties:
        type:
          description: The error code.
          type: string
          example: INVALID_PROMO_STACKING_TYPE
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The promotion stacking type filter isn't valid.
    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
    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
    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
    offsetQuery:
      type: object
      description: Provides pagination data.
      properties:
        size:
          type: integer
          format: int32
          example: 10
          minimum: 1
          maximum: 100
          default: 10
          description: The maximum number of records per page.
        offset:
          type: integer
          format: int32
          example: 10
          minimum: 0
          default: 0
          description: >-
            The number of records to skip before returning records. For example,
            with an offset of 20 and limit of 10, you will get records from 21
            to 30.
        count:
          type: integer
          format: int32
          example: 50
          description: The total number of available records.
    promoSearchObject:
      type: object
      properties:
        id:
          type: string
          description: >-
            The coupon ID generated when using the [create
            coupon](/v3/api-reference/offers/coupons/create-coupon) endpoint.
          example: abcdefg1ee7ce20123456789
        couponCodes:
          type: array
          description: >-
            A list of coupon codes that are applicable only for coupons. For
            coupons, the response includes promo codes associated with the
            coupon. For promotions, the response includes an empty array.
          example:
            - SUMMER100
            - SUMMER20
          items:
            type: string
        couponCodesCount:
          type: number
          description: >-
            The number of coupon codes associated with a coupon. This value is
            always `0` for promotions.
          example: 0
        status:
          type: string
          description: >
            The following are possible promotion statuses:

            - `ACTIVE`: The promotion is live and available.

            - `SCHEDULED`: The promotion is scheduled to be active at a future
            date.

            - `DISABLED`: The promotion is turned off and can be re-enabled
            later if required.

            - `EXPIRED`: The promotion is no longer valid.
          enum:
            - ACTIVE
            - SCHEDULED
            - DISABLED
            - EXPIRED
          example: SCHEDULED
        name:
          type: string
          description: The name of the promotion.
          example: CREATE PROMO
        startAt:
          type: string
          format: date-time
          description: The start time of the promotion, in UTC format.
          example: '2019-08-24T14:15:22.000Z'
        endAt:
          type: string
          format: date-time
          description: The end time of the promotion, in UTC format.
          example: '2019-08-25T14:15:22.000Z'
        updatedAt:
          type: string
          format: date-time
          description: The time when the promotion was last updated, in UTC format.
          example: '2019-08-20T14:15:22.000Z'
        singleMultiUse:
          type: string
          description: The field to indicate whether it's a single use or multi use coupon
          enum:
            - MULTI_USE
            - SINGLE_USE
          example: MULTI_USE
        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 coupon 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.
          example: PRODUCT
        level:
          type: number
          description: The level of the promotion to be evaluated.
          example: 1
        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
          description: The field to indicate whether the promotion is stackable or not.
          example: true
        isAlwaysApplied:
          type: boolean
          description: The field is true for an universal promotion.
          example: false
        additionalAttributes:
          type: array
          description: >-
            A placeholder for additional attributes related to promotions, 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
        promotionMessages:
          $ref: '#/components/schemas/promotionMessages'
        proximityMessages:
          $ref: '#/components/schemas/proximityMessages'
    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
    proximityMessages:
      type: object
      properties:
        threshold:
          type: integer
          minimum: 0
          description: >-
            The proximity threshold value. You muse use a value greater than or
            equal to 0.
          example: 1
        localizedMessages:
          type: array
          items:
            type: object
            properties:
              locales:
                type: array
                items:
                  type: string
                  description: The intended language or target region for the message.
                  example: en-CA
              message:
                type: string
                description: The localized message for the specified locales.
                example: Buy some more to get the discount!
  headers:
    xFabricRequestIdResponse:
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  securitySchemes:
    AuthorizationToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````