curl --request POST \
--url https://storefront.glood.ai/api/storefront/v3/headless/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop: <x-shop>' \
--data '
{
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"page_url": "<string>"
}
'import requests
url = "https://storefront.glood.ai/api/storefront/v3/headless/init"
payload = {
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"page_url": "<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({
user_id: '<string>',
client_id: '<string>',
customer_id: '<string>',
page_url: '<string>'
})
};
fetch('https://storefront.glood.ai/api/storefront/v3/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://storefront.glood.ai/api/storefront/v3/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([
'user_id' => '<string>',
'client_id' => '<string>',
'customer_id' => '<string>',
'page_url' => '<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://storefront.glood.ai/api/storefront/v3/headless/init"
payload := strings.NewReader("{\n \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<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://storefront.glood.ai/api/storefront/v3/headless/init")
.header("x-shop", "<x-shop>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://storefront.glood.ai/api/storefront/v3/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 \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"visit_id": "<string>",
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"visitor": {
"browsed_products": [
123
],
"cart_products": [
123
],
"purchased_products": [
123
]
},
"config": {
"shop": {
"money_format": "<string>",
"currency": "<string>"
},
"integrations_enabled": true,
"product_review_app": "<string>",
"analytics_enabled": true,
"skip_parent_product": true
},
"token": "<string>"
}{
"error": 123,
"message": "<string>"
}Headless Init
Identify a visitor and retrieve shop configuration. Call this once per session before fetching sections or sending events.
curl --request POST \
--url https://storefront.glood.ai/api/storefront/v3/headless/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop: <x-shop>' \
--data '
{
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"page_url": "<string>"
}
'import requests
url = "https://storefront.glood.ai/api/storefront/v3/headless/init"
payload = {
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"page_url": "<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({
user_id: '<string>',
client_id: '<string>',
customer_id: '<string>',
page_url: '<string>'
})
};
fetch('https://storefront.glood.ai/api/storefront/v3/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://storefront.glood.ai/api/storefront/v3/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([
'user_id' => '<string>',
'client_id' => '<string>',
'customer_id' => '<string>',
'page_url' => '<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://storefront.glood.ai/api/storefront/v3/headless/init"
payload := strings.NewReader("{\n \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<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://storefront.glood.ai/api/storefront/v3/headless/init")
.header("x-shop", "<x-shop>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://storefront.glood.ai/api/storefront/v3/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 \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"page_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"visit_id": "<string>",
"user_id": "<string>",
"client_id": "<string>",
"customer_id": "<string>",
"visitor": {
"browsed_products": [
123
],
"cart_products": [
123
],
"purchased_products": [
123
]
},
"config": {
"shop": {
"money_format": "<string>",
"currency": "<string>"
},
"integrations_enabled": true,
"product_review_app": "<string>",
"analytics_enabled": true,
"skip_parent_product": true
},
"token": "<string>"
}{
"error": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Shopify store URL
"shop.myshopify.com"
Body
Visitor identification payload
Anonymous visitor identifier (persisted across sessions)
Client/device identifier for the current session
Shopify customer ID for authenticated visitors
Type of the current page
home, product, collection, cart, checkout, order_status, search, other Full URL of the current page
Response
Visitor context and shop configuration
Unique identifier for this visit session
Anonymous visitor identifier to persist on the client
Client/device identifier
Shopify customer ID if authenticated
Visitor's historical activity context
Show child attributes
Show child attributes
Shop configuration relevant to the storefront
Show child attributes
Show child attributes
Short-lived session token to include in subsequent requests
Was this page helpful?