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

# Search Config

> Config for all three search features (instant, results page, image) plus filter definitions, filter tree, shop, analytics, translations and the Shopify storefront token. No Liquid templates and no widget css/js. Auth: `Authorization: Bearer <gl_sf_...>` + `x-shop`.

<ResponseExample>
  ```json 200 theme={null}
  {
    "config": {
      "instant_search_enabled": true,
      "search_result_page_enabled": true,
      "image_search_enabled": true,
      "personalization_enabled": false,
      "personalization_config": null,
      "auto_spell_correct_enabled": true,
      "instant_search_objects": ["product", "collection", "page", "auto_suggestion"],
      "exclude_out_of_stock": false,
      "move_out_of_stock_at_end": true,
      "site_wide_search": {},
      "search_result_count": 10,
      "default_ordering": "relevance",
      "minimum_type_ahead_input_count": 2,
      "default_search_result_page_size": 20,
      "search_page_autocomplete_enabled": true,
      "search_page_handle": "search",
      "image_search_pages": null,
      "settings": {}
    },
    "filters": [
      {
        "id": 1,
        "key": "color",
        "title": "Color",
        "type": "color",
        "attribute_type": "option",
        "position": 1,
        "expanded": true,
        "visible": true,
        "operator": "or",
        "settings": { "multi_select": true, "show_count": true, "collapsible": true, "searchable": false, "show_more": true, "max_display": 10 },
        "min": null, "max": null, "step": null, "unit": null, "suffix": null,
        "values": [
          { "value": "red", "label": "Red", "count": null, "position": 1, "hex": "#ff0000", "image": null, "order": null }
        ]
      }
    ],
    "filter_tree": {
      "id": 1,
      "target_page": "search",
      "target_ids": [],
      "is_default": true,
      "title": "Search filters",
      "settings": {},
      "data": [],
      "translations": {}
    },
    "shop": { "currency_format": "${{amount}}", "primary_locale": "en", "currency": "USD" },
    "analytics": { "enabled": true, "tracking_id": null },
    "translations": {},
    "token": "shpat_xxx",
    "metadata": { "region": "toronto", "locale": "en-US", "market": null }
  }
  ```

  ```json 400 theme={null}
  {
    "error": [
      {
        "message": "\"target_page\" must be one of [search, collection]",
        "path": ["target_page"],
        "type": "any.only",
        "context": { "label": "target_page", "key": "target_page" }
      }
    ],
    "ok": false
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /api/storefront/v1/headless/config
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/v1/headless/config:
    servers:
      - url: https://search.glood.ai
    post:
      description: >-
        Config for all three search features (instant, results page, image) plus
        filter definitions, filter tree, shop, analytics, translations and the
        Shopify storefront token. No Liquid templates and no widget css/js.
        Auth: `Authorization: Bearer <gl_sf_...>` + `x-shop`.
      parameters:
        - name: x-shop
          in: header
          description: >-
            Shopify store URL. Resolves the shop for the request (headless does
            not accept `?shop=`).
          required: true
          schema:
            type: string
            example: shop.myshopify.com
      requestBody:
        description: Request body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HeadlessConfigRequest'
      responses:
        '200':
          description: Search configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HeadlessConfigResponse'
        '400':
          description: Validation or shop error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    HeadlessConfigRequest:
      type: object
      description: >-
        Config request. Union of the legacy instant-config and search-config
        inputs.
      properties:
        locale:
          type: string
          description: BCP-47 locale for translations and locale-aware indexes.
          default: en-US
          example: en-US
        market:
          type: integer
          description: Shopify market id for market-aware pricing / catalog.
        theme:
          type: integer
          description: >-
            Theme id. Accepted for parity with the storefront config API; NOT
            used to render templates (headless responses carry no templates).
        target_page:
          type: string
          description: Which page's filter tree to resolve.
          enum:
            - search
            - collection
          default: search
        target_id:
          type: integer
          description: >-
            Target object id (e.g. collection id) when `target_page` is
            `collection`.
        skip_cache:
          type: boolean
          description: Bypass the cached config and recompute.
          default: false
        visitor_id:
          type: string
          description: >-
            Anonymous device/browser UID (the `gl_s_uid` cookie). The primary
            personalization key; stays stable when a customer logs in.
        client_id:
          type: string
          description: Per-session / per-device identifier.
        customer_id:
          type: string
          description: >-
            Shopify customer id. Present only when the shopper is logged in;
            enables customer-level personalization.
    HeadlessConfigResponse:
      type: object
      description: >-
        Config for all three features plus filter definitions, tree, shop,
        analytics, translations and token.
      properties:
        config:
          description: >-
            Merged instant / search / image feature config. No Liquid templates,
            no widget css/js.
          allOf:
            - $ref: '#/components/schemas/HeadlessFeatureConfig'
        filters:
          type: array
          description: Facet (filter) definitions for the resolved tree.
          items:
            $ref: '#/components/schemas/HeadlessSearchFacet'
        filter_tree:
          nullable: true
          allOf:
            - type: object
              description: Resolved filter tree with full layout data.
              properties:
                id:
                  type: integer
                  description: Filter tree id.
                target_page:
                  type: string
                  description: Page the tree targets.
                  enum:
                    - search
                    - collection
                target_ids:
                  type: array
                  description: Object ids the tree applies to.
                  items:
                    type: integer
                is_default:
                  type: boolean
                  description: Whether this is the default tree for its target page.
                title:
                  type: string
                  description: Localised tree title.
                settings:
                  type: object
                  description: Tree-level settings.
                data:
                  type: array
                  description: Ordered tree layout (filters + groups).
                  items:
                    type: object
                translations:
                  type: object
                  description: Per-locale translation bundle for the tree.
          description: Resolved filter tree, or null when none exists.
        shop:
          type: object
          description: Minimal shop context.
          properties:
            currency_format:
              type: string
              description: Shopify money format string.
              example: ${{amount}}
            primary_locale:
              type: string
              description: Shop primary locale.
              example: en
            currency:
              type: string
              description: Shop default currency code.
              example: USD
        analytics:
          type: object
          description: Analytics configuration.
          properties:
            enabled:
              type: boolean
              description: Whether analytics tracking is enabled.
            tracking_id:
              type: string
              nullable: true
              description: Analytics tracking id, if configured.
        translations:
          type: object
          description: Translation bundle for the requested locale.
        token:
          type: string
          nullable: true
          description: Shopify storefront access token for direct Storefront API calls.
        metadata:
          type: object
          description: Response metadata.
          properties:
            region:
              type: string
              description: Data-plane region serving this shop.
              example: toronto
            locale:
              type: string
              description: Resolved locale.
            market:
              type: integer
              nullable: true
              description: Echoed market id.
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    HeadlessFeatureConfig:
      type: object
      description: >-
        Merged instant / search / image feature config (from
        `getHeadlessConfigResponse`). Feature flags and functional settings only
        — no Liquid templates, no widget css/js.
      properties:
        instant_search_enabled:
          type: boolean
          description: Whether the instant (type-ahead) search feature is enabled.
        search_result_page_enabled:
          type: boolean
          description: Whether the full search results page feature is enabled.
        image_search_enabled:
          type: boolean
          description: Whether visual (image) search is enabled.
        personalization_enabled:
          type: boolean
          description: Whether personalization is enabled for this shop.
        personalization_config:
          type: object
          nullable: true
          description: Personalization tuning config, or null when disabled.
        auto_spell_correct_enabled:
          type: boolean
          description: Whether automatic spell correction is applied to instant search.
        instant_search_objects:
          type: array
          description: Default result blocks for instant search.
          items:
            type: string
          example:
            - product
            - collection
            - page
            - auto_suggestion
        exclude_out_of_stock:
          type: boolean
          description: Whether out-of-stock products are excluded from results.
        move_out_of_stock_at_end:
          type: boolean
          description: >-
            Whether out-of-stock products are pushed to the end instead of
            excluded.
        site_wide_search:
          type: object
          description: Site-wide search feature settings.
        search_result_count:
          type: integer
          description: Default number of instant-search results per type.
        default_ordering:
          type: string
          description: Default sort ordering for the results page.
          example: relevance
        minimum_type_ahead_input_count:
          type: integer
          description: >-
            Minimum query length before instant search fires (below this,
            trending is returned).
        default_search_result_page_size:
          type: integer
          description: Default page size for the search results page.
        search_page_autocomplete_enabled:
          type: boolean
          description: Whether autocomplete is enabled on the search page.
        search_page_handle:
          type: string
          nullable: true
          description: Storefront handle of the search page.
        image_search_pages:
          type: object
          nullable: true
          description: Pages where image search is surfaced, or null.
        settings:
          type: object
          description: Functional feature settings only. Contains NO presentation css/js.
    HeadlessSearchFacet:
      type: object
      description: A DB-driven facet (filter) definition, without live counts.
      properties:
        id:
          type: integer
          description: Filter definition id.
        key:
          type: string
          description: Stable filter key used when applying the filter (e.g. `color`).
        title:
          type: string
          description: Localised display title of the facet.
        type:
          type: string
          description: Data type of the facet (e.g. `list`, `number`, `color`, `size`).
        attribute_type:
          type: string
          description: >-
            Underlying product attribute the facet maps to (e.g. `option`,
            `price`, `tag`, `vendor`).
        position:
          type: integer
          description: Display order of the facet within its tree.
        expanded:
          type: boolean
          description: Whether the facet renders expanded by default.
        visible:
          type: boolean
          description: Whether the facet is shown in the UI.
        operator:
          type: string
          description: Default combine operator for selected values.
          enum:
            - or
            - and
        settings:
          type: object
          description: Facet presentation settings (functional only, no CSS/JS).
          properties:
            multi_select:
              type: boolean
              description: Allow selecting multiple values.
            show_count:
              type: boolean
              description: Show per-value match counts.
            collapsible:
              type: boolean
              description: Facet can be collapsed.
            searchable:
              type: boolean
              description: Show a value search box within the facet.
            show_more:
              type: boolean
              description: Show a 'show more' toggle when values exceed `max_display`.
            max_display:
              type: integer
              description: How many values to show before the 'show more' toggle.
        min:
          type: number
          nullable: true
          description: Range minimum. Populated only for numeric / price facets.
        max:
          type: number
          nullable: true
          description: Range maximum. Populated only for numeric / price facets.
        step:
          type: number
          nullable: true
          description: Slider step. Numeric / price facets only.
        unit:
          type: string
          nullable: true
          description: Value prefix (e.g. currency symbol). Numeric / price facets only.
        suffix:
          type: string
          nullable: true
          description: Value suffix (e.g. unit label). Numeric / price facets only.
        values:
          type: array
          description: >-
            Selectable values for this facet. Empty when `include_values` is
            false.
          items:
            $ref: '#/components/schemas/HeadlessSearchFacetValue'
    HeadlessSearchFacetValue:
      type: object
      description: A selectable value within a facet definition.
      properties:
        value:
          type: string
          description: Raw facet value used when applying the filter.
        label:
          type: string
          description: Human-readable label for the value.
        count:
          type: integer
          nullable: true
          description: >-
            Live match count. Always `null` in facet definitions (API 3);
            populated by filter aggregations (API 4).
        position:
          type: integer
          description: Display order of this value within the facet.
        hex:
          type: string
          nullable: true
          description: Swatch color hex, for `color` facets only.
        image:
          type: string
          nullable: true
          description: Swatch image URL, for `color` facets only.
        order:
          type: integer
          nullable: true
          description: Explicit sort order, for `size` facets only.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````