curl --request POST \
--url https://search.glood.ai/api/storefront/v1/headless/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop: <x-shop>' \
--data '
{
"page_url": "<string>",
"session_id": "<string>",
"locale": "en-US",
"market": 123,
"publication_ids": [
"30085840999"
],
"visitor_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>"
}
'import requests
url = "https://search.glood.ai/api/storefront/v1/headless/init"
payload = {
"page_url": "<string>",
"session_id": "<string>",
"locale": "en-US",
"market": 123,
"publication_ids": ["30085840999"],
"visitor_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>"
}
headers = {
"x-shop": "<x-shop>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-shop': '<x-shop>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
page_url: '<string>',
session_id: '<string>',
locale: 'en-US',
market: 123,
publication_ids: ['30085840999'],
visitor_id: '<string>',
client_id: '<string>',
customer_id: '<string>'
})
};
fetch('https://search.glood.ai/api/storefront/v1/headless/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://search.glood.ai/api/storefront/v1/headless/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'page_url' => '<string>',
'session_id' => '<string>',
'locale' => 'en-US',
'market' => 123,
'publication_ids' => [
'30085840999'
],
'visitor_id' => '<string>',
'client_id' => '<string>',
'customer_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop: <x-shop>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://search.glood.ai/api/storefront/v1/headless/init"
payload := strings.NewReader("{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-shop", "<x-shop>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://search.glood.ai/api/storefront/v1/headless/init")
.header("x-shop", "<x-shop>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://search.glood.ai/api/storefront/v1/headless/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-shop"] = '<x-shop>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"visit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"visitor_id": "gl_s_uid_9f2c",
"client_id": "c_18a4",
"customer_id": null,
"visitor": {
"browsed_products": [9311227838783, 9311227838784],
"cart_products": [9311227838785],
"purchased_products": []
},
"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": {}
},
"token": "shpat_xxx",
"metadata": { "region": "toronto", "locale": "en-US", "market": null }
}
{
"error": [
{
"message": "\"page_type\" must be one of [product_page, collection, home, cart, order_confirm, blog, ajax_cart, 404, checkout, returns, search, other]",
"path": ["page_type"],
"type": "any.only",
"context": { "label": "page_type", "key": "page_type" }
}
],
"ok": false
}
Headless Search Init
Session bootstrap for the search suite. Call once per session (the @glood/hydrogen GloodProvider runs it automatically on mount) before instant/full search. Resolves the visitor, returns their history (browsed / cart / purchased product ids), a lean feature-flag config (no filter definitions, no filter tree, no templates), the Shopify storefront token and a fresh visit_id. Auth: Authorization: Bearer <gl_sf_...> + x-shop.
curl --request POST \
--url https://search.glood.ai/api/storefront/v1/headless/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop: <x-shop>' \
--data '
{
"page_url": "<string>",
"session_id": "<string>",
"locale": "en-US",
"market": 123,
"publication_ids": [
"30085840999"
],
"visitor_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>"
}
'import requests
url = "https://search.glood.ai/api/storefront/v1/headless/init"
payload = {
"page_url": "<string>",
"session_id": "<string>",
"locale": "en-US",
"market": 123,
"publication_ids": ["30085840999"],
"visitor_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>"
}
headers = {
"x-shop": "<x-shop>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-shop': '<x-shop>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
page_url: '<string>',
session_id: '<string>',
locale: 'en-US',
market: 123,
publication_ids: ['30085840999'],
visitor_id: '<string>',
client_id: '<string>',
customer_id: '<string>'
})
};
fetch('https://search.glood.ai/api/storefront/v1/headless/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://search.glood.ai/api/storefront/v1/headless/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'page_url' => '<string>',
'session_id' => '<string>',
'locale' => 'en-US',
'market' => 123,
'publication_ids' => [
'30085840999'
],
'visitor_id' => '<string>',
'client_id' => '<string>',
'customer_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop: <x-shop>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://search.glood.ai/api/storefront/v1/headless/init"
payload := strings.NewReader("{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-shop", "<x-shop>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://search.glood.ai/api/storefront/v1/headless/init")
.header("x-shop", "<x-shop>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://search.glood.ai/api/storefront/v1/headless/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-shop"] = '<x-shop>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"page_url\": \"<string>\",\n \"session_id\": \"<string>\",\n \"locale\": \"en-US\",\n \"market\": 123,\n \"publication_ids\": [\n \"30085840999\"\n ],\n \"visitor_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"visit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"visitor_id": "gl_s_uid_9f2c",
"client_id": "c_18a4",
"customer_id": null,
"visitor": {
"browsed_products": [9311227838783, 9311227838784],
"cart_products": [9311227838785],
"purchased_products": []
},
"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": {}
},
"token": "shpat_xxx",
"metadata": { "region": "toronto", "locale": "en-US", "market": null }
}
{
"error": [
{
"message": "\"page_type\" must be one of [product_page, collection, home, cart, order_confirm, blog, ajax_cart, 404, checkout, returns, search, other]",
"path": ["page_type"],
"type": "any.only",
"context": { "label": "page_type", "key": "page_type" }
}
],
"ok": false
}
{
"visit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"visitor_id": "gl_s_uid_9f2c",
"client_id": "c_18a4",
"customer_id": null,
"visitor": {
"browsed_products": [9311227838783, 9311227838784],
"cart_products": [9311227838785],
"purchased_products": []
},
"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": {}
},
"token": "shpat_xxx",
"metadata": { "region": "toronto", "locale": "en-US", "market": null }
}
{
"error": [
{
"message": "\"page_type\" must be one of [product_page, collection, home, cart, order_confirm, blog, ajax_cart, 404, checkout, returns, search, other]",
"path": ["page_type"],
"type": "any.only",
"context": { "label": "page_type", "key": "page_type" }
}
],
"ok": false
}
Authorizations
Headers
Body
Session context. All fields optional.
Search session bootstrap input (from initSchema). Every field is optional; send the identity triple you have so the visitor profile and history resolve correctly.
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/.
50^[0-9]+$["30085840999"]
Response
Visitor context, history, lean config and token
Session bootstrap payload (from getHeadlessInitResponse): identity, visitor history, lean feature config, storefront token and a fresh visit id. Unlike the config endpoint it carries NO filter definitions and NO filter tree.
Was this page helpful?