Skip to main content
GET
/
api
/
v1
/
search
/
suggest.json
Search Autocomplete
curl --request GET \
  --url https://api.launchmystore.io/api/v1/search/suggest.json \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "data": {
    "query": "<string>",
    "queries": [
      {}
    ],
    "products": [
      {}
    ],
    "collections": [
      {}
    ],
    "pages": [
      {}
    ],
    "articles": [
      {}
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt

Use this file to discover all available pages before exploring further.

Search Autocomplete

Returns search suggestions for autocomplete functionality. Provides fast, lightweight results for real-time search interfaces.

Request

curl -X GET "https://api.launchmystore.io/api/v1/search/suggest.json?q=shir" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Parameters

q
string
required
Partial search query (minimum 2 characters)
limit
integer
default:"10"
Maximum suggestions to return (max 20)
types
string
default:"product,collection,page"
Comma-separated list of result types: product, collection, page, article, query

Response

success
boolean
Whether the request succeeded
data
object
Suggestion results grouped by type

Example Response

{
  "success": true,
  "data": {
    "query": "shir",
    "queries": [
      {
        "text": "shirt",
        "results_count": 45
      },
      {
        "text": "shirts for men",
        "results_count": 28
      },
      {
        "text": "shirt dress",
        "results_count": 12
      }
    ],
    "products": [
      {
        "id": "prod_abc123",
        "title": "Classic Cotton Shirt",
        "handle": "classic-cotton-shirt",
        "price": 4500,
        "image": {
          "src": "https://cdn.launchmystore.io/images/shirt-thumb.jpg"
        },
        "available": true
      },
      {
        "id": "prod_def456",
        "title": "Linen Summer Shirt",
        "handle": "linen-summer-shirt",
        "price": 5500,
        "image": {
          "src": "https://cdn.launchmystore.io/images/linen-shirt-thumb.jpg"
        },
        "available": true
      }
    ],
    "collections": [
      {
        "id": "col_shirts",
        "title": "Shirts",
        "handle": "shirts",
        "products_count": 45
      }
    ],
    "pages": [],
    "articles": []
  }
}

Lightweight Product Response

Autocomplete returns minimal product data for fast responses:
FieldDescription
idProduct ID
titleProduct title
handleURL handle
priceLowest variant price
imageFirst product image (small)
availableAvailability status

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 the types parameter to limit result types for faster responses

Example Implementation

// React example with debouncing
const [suggestions, setSuggestions] = useState([]);
const debouncedSearch = useMemo(
  () => debounce(async (query) => {
    if (query.length < 2) {
      setSuggestions([]);
      return;
    }
    const res = await fetch(
      `/api/v1/search/suggest?q=${encodeURIComponent(query)}&limit=8`
    );
    const data = await res.json();
    setSuggestions(data.data);
  }, 300),
  []
);

Error Codes

CodeDescription
UNAUTHORIZEDInvalid or missing access token
VALIDATION_ERRORQuery too short (minimum 2 characters)