Search Autocomplete
curl --request GET \
--url https://{store-domain}/search/suggest.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://{store-domain}/search/suggest.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{store-domain}/search/suggest.json', 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://{store-domain}/search/suggest.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{store-domain}/search/suggest.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{store-domain}/search/suggest.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{store-domain}/search/suggest.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"resources": {
"results": {
"products": [
{}
],
"collections": [
{}
],
"articles": [
{}
],
"pages": [
{}
]
}
}
}Search
Search Autocomplete
Predictive search suggestions for autocomplete
GET
/
search
/
suggest.json
Search Autocomplete
curl --request GET \
--url https://{store-domain}/search/suggest.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://{store-domain}/search/suggest.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{store-domain}/search/suggest.json', 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://{store-domain}/search/suggest.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{store-domain}/search/suggest.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{store-domain}/search/suggest.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{store-domain}/search/suggest.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"resources": {
"results": {
"products": [
{}
],
"collections": [
{}
],
"articles": [
{}
],
"pages": [
{}
]
}
}
}Search Autocomplete
Returns predictive-search suggestions for autocomplete UIs. This is a storefront endpoint served from the store domain — no OAuth token is required (it is the same endpoint themes call from the browser). There are two response shapes:GET /search/suggest.json— returns a compatible JSON payload.GET /search/suggest— returns a rendered HTML section (used by themes that render the predictive-search drawer markup directly).
Request
curl -X GET "https://mystore.launchmystore.io/search/suggest.json?q=shir&resources[type]=product,collection"
Parameters
string
required
Search query (predictive search activates at 2+ characters). Also accepts
the
query alias, and search syntax such as id:123 OR id:456.string
default:"product,collection,article,page"
Comma-separated result types:
product, collection, article, page.integer
default:"10"
Maximum results per type (max 50). Also accepts the
limit alias.Response
Matches the/search/suggest.json shape: a top-level resources
object containing results grouped by type.
object
Example Response
{
"resources": {
"results": {
"products": [
{
"id": "prod_abc123",
"title": "Classic Cotton Shirt",
"handle": "classic-cotton-shirt",
"description": "A breathable everyday cotton shirt.",
"published_at": "2024-01-10T08:00:00.000Z",
"vendor": "Acme",
"product_type": "Shirts",
"tags": ["cotton", "casual"],
"price": "45.00",
"price_min": "45.00",
"price_max": "45.00",
"available": true,
"image": "https://cdn.launchmystore.io/images/shirt-thumb.jpg",
"featured_image": "https://cdn.launchmystore.io/images/shirt-thumb.jpg",
"url": "/products/classic-cotton-shirt"
}
],
"collections": [
{
"id": "col_shirts",
"title": "Shirts",
"handle": "shirts",
"description": "All shirts.",
"published_at": "2024-01-01T00:00:00.000Z",
"image": "https://cdn.launchmystore.io/images/shirts.jpg",
"url": "/collections/shirts",
"products_count": 45
}
],
"articles": [],
"pages": []
}
}
}
Performance Tips
- Use debouncing (300ms) in your UI before making requests.
- Start searching at 2+ characters for relevant results.
- Cache frequent queries on the client.
- Use
resources[type]to limit result types for faster responses.
Example Implementation
// React example with debouncing
const [suggestions, setSuggestions] = useState(null);
const debouncedSearch = useMemo(
() => debounce(async (query) => {
if (query.length < 2) {
setSuggestions(null);
return;
}
const res = await fetch(
`/search/suggest.json?q=${encodeURIComponent(query)}&resources[limit]=8`
);
const data = await res.json();
setSuggestions(data.resources.results);
}, 300),
[]
);