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

# The badges a product currently earns

> Computed merchandising badges for one product (on sale, stock state, bestseller, trending, new in, tag/collection badges, ...), store-wide scope. Read-only. Returns [] when the product earns none, and also when the badge service cannot answer (badges are decoration, so a failure is logged, not surfaced).



## OpenAPI

````yaml /api-reference/openapi/lite.json get /products/{product_id}/badges
openapi: 3.1.0
info:
  title: Search & Merchandising API
  version: 1.0.0
  description: >-
    REST API behind Depict: Search & Merchandising, the native Shopify app:
    onboarding, collections, boost & bury, dashboards, A/B testing and
    multi-store management. Endpoints are served under the /api/lite prefix and
    are authenticated with the Shopify session token that App Bridge issues to
    the embedded app.
servers:
  - url: /api/lite
security:
  - ShopifySessionToken: []
paths:
  /products/{product_id}/badges:
    get:
      summary: The badges a product currently earns
      description: >-
        Computed merchandising badges for one product (on sale, stock state,
        bestseller, trending, new in, tag/collection badges, ...), store-wide
        scope. Read-only. Returns [] when the product earns none, and also when
        the badge service cannot answer (badges are decoration, so a failure is
        logged, not surfaced).
      operationId: productBadges
      parameters:
        - schema:
            type: string
            description: Shopify product id (numeric string).
          required: true
          description: Shopify product id (numeric string).
          name: product_id
          in: path
        - schema:
            type: string
            description: Lite merchant id, e.g. `shopify-<shop id>`.
          required: true
          description: Lite merchant id, e.g. `shopify-<shop id>`.
          name: merchant_id
          in: query
      responses:
        '200':
          description: The product's badges, possibly empty.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProductBadge'
        '400':
          description: The query failed its schema; `detail` carries zod's messages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '401':
          description: Not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '403':
          description: Authenticated, but this identity may not call the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '404':
          description: Merchant not found for this caller.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '500':
          description: Internal error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
components:
  schemas:
    ProductBadge:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - on_sale
            sale_percentage:
              type: number
            markets_on_sale:
              type:
                - array
                - 'null'
              items:
                type: object
                properties:
                  market_id:
                    type: string
                  display_name:
                    type: string
                required:
                  - market_id
                  - display_name
              description: Markets where the product is on sale, when not all are.
            total_markets:
              type:
                - integer
                - 'null'
            market_group_display_name:
              type:
                - string
                - 'null'
          required:
            - type
            - sale_percentage
        - type: object
          properties:
            type:
              type: string
              enum:
                - out_of_stock
          required:
            - type
        - type: object
          properties:
            type:
              type: string
              enum:
                - partially_out_of_stock
          required:
            - type
        - type: object
          properties:
            type:
              type: string
              enum:
                - partially_low_stock
          required:
            - type
        - type: object
          properties:
            type:
              type: string
              enum:
                - new_in
            published_at:
              type: string
            date_source:
              type: string
              enum:
                - published_at
                - created_at
          required:
            - type
            - published_at
        - type: object
          properties:
            value:
              type: number
            n_days:
              type: integer
              description: Window the value was measured over.
            type:
              type: string
              enum:
                - bestseller
          required:
            - value
            - n_days
            - type
        - type: object
          properties:
            value:
              type: number
            n_days:
              type: integer
              description: Window the value was measured over.
            type:
              type: string
              enum:
                - bestseller_revenue
            currency:
              type:
                - string
                - 'null'
              description: ISO currency of `value`.
          required:
            - value
            - n_days
            - type
        - type: object
          properties:
            value:
              type: number
            n_days:
              type: integer
              description: Window the value was measured over.
            type:
              type: string
              enum:
                - slow_mover
          required:
            - value
            - n_days
            - type
        - type: object
          properties:
            value:
              type: number
            n_days:
              type: integer
              description: Window the value was measured over.
            type:
              type: string
              enum:
                - trending
          required:
            - value
            - n_days
            - type
        - type: object
          properties:
            value:
              type: number
            n_days:
              type: integer
              description: Window the value was measured over.
            type:
              type: string
              enum:
                - trending_revenue
            currency:
              type:
                - string
                - 'null'
              description: ISO currency of `value`.
          required:
            - value
            - n_days
            - type
        - type: object
          properties:
            type:
              type: string
              enum:
                - few_variants_available
            variant_options_available:
              type: array
              items:
                type: object
                additionalProperties:
                  type: string
              description: Option name → value, one entry per variant still available.
            n_variants_total:
              type: integer
          required:
            - type
            - variant_options_available
            - n_variants_total
        - type: object
          properties:
            type:
              type: string
              enum:
                - tag
            tag:
              type: string
          required:
            - type
            - tag
        - type: object
          properties:
            type:
              type: string
              enum:
                - collection
            collection_id:
              type: string
            collection_title:
              type: string
          required:
            - type
            - collection_id
            - collection_title
    Detail:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
      description: 'Every 4xx/5xx body: `{detail}`.'
  securitySchemes:
    ShopifySessionToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Shopify App Bridge session token of the embedded Depict: Search &
        Merchandising app. The shop in the token determines the merchant;
        merchant_id parameters must belong to that shop.

````