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

# Get Headless Sections

> Get recommendation sections with full product details for a given page context.



## OpenAPI

````yaml POST /api/storefront/v3/headless/sections
openapi: 3.0.1
info:
  title: Glood.AI API Reference
  description: Glood.AI API Reference
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://storefront.glood.ai
security:
  - bearerAuth: []
paths:
  /api/storefront/v3/headless/sections:
    post:
      description: >-
        Get recommendation sections with full product details for a given page
        context.
      parameters:
        - name: x-shop
          in: header
          description: Shopify store URL
          required: true
          schema:
            type: string
            example: shop.myshopify.com
      requestBody:
        description: Page context and section request payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HeadlessSectionsRequest'
      responses:
        '200':
          description: Sections with product details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HeadlessSectionsResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    HeadlessSectionsRequest:
      type: object
      required:
        - page_url
        - page_type
        - locale
      properties:
        client_id:
          type: string
          description: Client/device identifier
        user_id:
          type: string
          description: Anonymous visitor identifier
        customer_id:
          type: string
          description: Shopify customer ID for authenticated visitors
        page_url:
          type: string
          description: Full URL of the current page
        page_type:
          type: string
          description: Type of the current page
          enum:
            - home
            - product
            - collection
            - cart
            - checkout
            - order_status
            - search
            - other
        product_id:
          type: integer
          description: ID of the current product (required for product pages)
        cart_product_ids:
          type: array
          items:
            type: integer
          description: Product IDs currently in the visitor's cart
        locale:
          type: string
          description: BCP 47 locale code for the response language
          example: en
        market:
          type: string
          description: Shopify market handle for market-specific content
        publicationIds:
          type: array
          items:
            oneOf:
              - type: string
                pattern: ^[0-9]+$
              - type: integer
          maxItems: 50
          description: >-
            Optional. Numeric Shopify publication (sales channel) ids. When
            present, only products published on at least one of these channels
            are returned and the default "published to the Online Store" gate is
            replaced by this filter; market and B2B filters still apply. A
            single id may be sent without the array wrapper. Each id must be one
            the merchant enabled under Settings → Sales channels; unknown ids
            return 400. The id is the numeric tail of
            gid://shopify/Publication/<id>.
          example:
            - '30085840999'
        sections:
          type: array
          items:
            type: string
          description: >-
            Specific section IDs to fetch. Omit to fetch all eligible sections
            for the page.
        placed_sections:
          type: array
          items:
            type: string
          description: Section IDs already rendered on the page (used to avoid duplicates)
        preview:
          type: boolean
          description: When true, returns sections in preview/draft mode
        tags:
          type: array
          items:
            type: string
          description: Product tags to scope recommendation results
        collection:
          type: string
          description: Collection handle for collection-page context
        currency:
          type: string
          description: Currency code for pricing (defaults to shop currency)
        zipcode:
          type: string
          description: Visitor's zip/postal code for location-based recommendations
        cart_value:
          type: number
          description: Total value of the visitor's current cart
    HeadlessSectionsResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Unique identifier for this request (use for event tracking)
        visit_id:
          type: string
          description: Current visit session identifier
        sections:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Section identifier
              layout:
                type: string
                description: Display layout type for the section
              location:
                type: string
                description: Page location where the section should be rendered
              type:
                type: string
                description: Recommendation algorithm type
              position:
                type: integer
                description: Render order position among sections
              title:
                type: string
                description: Display title of the section
              extra:
                type: object
                description: Additional section-specific configuration
              discount_config:
                type: object
                description: Discount configuration applied to this section
              show_discount_label:
                type: boolean
                description: Whether to show a discount label on products
              translations:
                type: object
                description: Localised text strings for the section UI
              products:
                type: array
                items:
                  $ref: '#/components/schemas/HeadlessProduct'
        product:
          $ref: '#/components/schemas/HeadlessProduct'
          description: The current page's product (populated on product pages)
        token:
          type: string
          description: Refreshed session token
        config:
          type: object
          description: >-
            Shop configuration snapshot (same shape as
            HeadlessInitResponse.config)
        experience:
          type: object
          description: A/B test experience assignment for this request
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    HeadlessProduct:
      type: object
      properties:
        product_id:
          type: integer
          description: Unique identifier of the product
        title:
          type: string
          description: Title of the product
        price:
          type: number
          description: Minimum variant price for the product
        tags:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: >-
            Product tags. Recommendations return a comma-separated string;
            search returns an array of strings.
        product_type:
          type: string
          description: Type/category of the product
        vendor:
          type: string
          description: Vendor/brand of the product
        image:
          type: object
          properties:
            id:
              type: string
            url:
              type: string
            height:
              type: integer
            width:
              type: integer
            altText:
              type: string
        handle:
          type: string
          description: URL handle/slug for the product
        compare_at_price:
          type: number
          description: Original/compare-at price of the product
        options:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
                description: Option name (e.g. Size, Color)
              values:
                type: array
                items:
                  type: string
              position:
                type: integer
        variants:
          type: array
          items:
            $ref: '#/components/schemas/HeadlessProductVariant'
        metafields:
          oneOf:
            - type: object
              description: Key-value map (recommendations).
            - type: array
              items:
                type: object
                description: A metafield.
                properties:
                  namespace:
                    type: string
                    description: Metafield namespace.
                  key:
                    type: string
                    description: Metafield key.
                  value:
                    type: string
                    description: Metafield value.
          description: >-
            Product metafields. Recommendations return a key-value map; search
            returns a list of `{ namespace, key, value }`.
        display_price:
          type: number
          nullable: true
          description: >-
            Currency-converted price for the requested market (search). Falls
            back to `price`.
        display_compare_at_price:
          type: number
          nullable: true
          description: Currency-converted compare-at price for the market (search).
        display_currency:
          type: string
          description: Currency code the display prices are expressed in (search).
        original_currency:
          type: string
          description: Shop's original currency code (search).
        currency_rate:
          type: number
          description: Conversion rate applied to derive display prices (search).
        available_for_sale:
          type: boolean
          description: Whether the product has any variant available for sale (search).
        is_in_stock:
          type: boolean
          description: Whether the product has any in-stock variant (search).
        total_inventory:
          type: integer
          nullable: true
          description: Total inventory across variants (search).
        featured_media:
          type: object
          nullable: true
          description: Featured media object (search).
        media:
          type: array
          description: Product media objects (search).
          items:
            type: object
    HeadlessProductVariant:
      type: object
      properties:
        variant_id:
          type: integer
          description: Unique identifier of the variant
        title:
          type: string
          description: Title of the variant
        display_name:
          type: string
          description: Human-readable display name of the variant
        position:
          type: integer
          description: Display order position of the variant
        sku:
          type: string
          description: Stock keeping unit identifier
        selected_options:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Option name
              value:
                type: string
                description: Selected value
        price:
          oneOf:
            - type: string
            - type: number
          nullable: true
          description: >-
            Variant price. Recommendations return a decimal string; search
            returns a number.
        compare_at_price:
          oneOf:
            - type: string
            - type: number
          nullable: true
          description: >-
            Variant compare-at price. String (recommendations) or number
            (search); null when unset.
        image:
          type: object
          properties:
            id:
              type: string
            url:
              type: string
            height:
              type: integer
            width:
              type: integer
            altText:
              type: string
        sellable_online_quantity:
          type: integer
          description: Quantity available for online sale
        is_in_stock:
          type: boolean
          description: Whether the variant is currently in stock
        available_for_sale:
          type: boolean
          description: Whether the variant is available for purchase
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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