> ## 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
        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:
          type: string
          description: Comma-separated list of product tags
        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:
          type: object
          description: Key-value map of product metafields included per shop configuration
    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:
          type: string
          description: Variant price
        compare_at_price:
          type: string
          description: Original/compare-at price of the variant
        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

````