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

# Headless Init

> Identify a visitor and retrieve shop configuration. Call this once per session before fetching sections or sending events.



## OpenAPI

````yaml POST /api/storefront/v3/headless/init
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/init:
    post:
      description: >-
        Identify a visitor and retrieve shop configuration. Call this once per
        session before fetching sections or sending events.
      parameters:
        - name: x-shop
          in: header
          description: Shopify store URL
          required: true
          schema:
            type: string
            example: shop.myshopify.com
      requestBody:
        description: Visitor identification payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HeadlessInitRequest'
      responses:
        '200':
          description: Visitor context and shop configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HeadlessInitResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    HeadlessInitRequest:
      type: object
      properties:
        user_id:
          type: string
          description: Anonymous visitor identifier (persisted across sessions)
        client_id:
          type: string
          description: Client/device identifier for the current session
        customer_id:
          type: string
          description: Shopify customer ID for authenticated visitors
        page_type:
          type: string
          description: Type of the current page
          enum:
            - home
            - product
            - collection
            - cart
            - checkout
            - order_status
            - search
            - other
        page_url:
          type: string
          description: Full URL of the current page
    HeadlessInitResponse:
      type: object
      properties:
        visit_id:
          type: string
          description: Unique identifier for this visit session
        user_id:
          type: string
          description: Anonymous visitor identifier to persist on the client
        client_id:
          type: string
          description: Client/device identifier
        customer_id:
          type: string
          description: Shopify customer ID if authenticated
        visitor:
          type: object
          description: Visitor's historical activity context
          properties:
            browsed_products:
              type: array
              items:
                type: integer
              description: Product IDs recently viewed by the visitor
            cart_products:
              type: array
              items:
                type: integer
              description: Product IDs currently in the visitor's cart
            purchased_products:
              type: array
              items:
                type: integer
              description: Product IDs previously purchased by the visitor
        config:
          type: object
          description: Shop configuration relevant to the storefront
          properties:
            shop:
              type: object
              properties:
                money_format:
                  type: string
                  description: Shopify money format string
                currency:
                  type: string
                  description: Shop's default currency code
            integrations_enabled:
              type: boolean
              description: Whether Glood integrations are active for this shop
            product_review_app:
              type: string
              description: Product review app integrated with the shop, if any
            analytics_enabled:
              type: boolean
              description: Whether analytics tracking is enabled
            skip_parent_product:
              type: boolean
              description: Whether to skip the parent product in recommendation results
        token:
          type: string
          description: Short-lived session token to include in subsequent requests
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````