API Reference
Search API
Query the SearchX search engine programmatically via the REST API.
Overview
The Search API allows you to perform search queries against your product index from server-side code. This is useful for building custom search interfaces or integrating search into your backend workflows.
Search Endpoint
GET /api/v1/instant-search
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | The search query string |
app_id | string | Yes | Your Application ID |
limit | integer | No | Maximum number of results (default: 20, max: 100) |
offset | integer | No | Number of results to skip for pagination |
filter | string | No | Filter expression (e.g., brand = "Nike") |
sort | string | No | Sort expression (e.g., price:asc) |
facets | string[] | No | List of attributes to return facet counts for |
Example Request
curl -X GET "https://admin.searchxengine.ai/api/v1/instant-search?q=smartphone&app_id=YOUR_APP_ID&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Example Response
{
"hits": [
{
"id": "SKU-001",
"title": "iPhone 15 Pro",
"description": "Latest Apple smartphone with A17 chip",
"price": 999.99,
"sale_price": 949.99,
"image": "https://mystore.com/images/iphone15.jpg",
"url": "https://mystore.com/products/iphone-15-pro",
"brand": "Apple",
"categories": ["Electronics", "Smartphones"],
"availability": "in_stock"
}
],
"query": "smartphone",
"processingTimeMs": 12,
"estimatedTotalHits": 45,
"limit": 10,
"offset": 0,
"facetDistribution": {
"brand": {
"Apple": 12,
"Samsung": 15,
"Google": 8
}
}
}
Filtering
Use filter expressions to narrow results:
# Single filter
?filter=brand = "Apple"
# Multiple filters
?filter=brand = "Apple" AND price < 1000
# Range filter
?filter=price 500 TO 1000
Sorting
Sort results using attribute and direction:
# Sort by price ascending
?sort=price:asc
# Sort by price descending
?sort=price:desc
Pagination
Use limit and offset for pagination:
# Page 1 (first 20 results)
?limit=20&offset=0
# Page 2
?limit=20&offset=20
# Page 3
?limit=20&offset=40
Rate Limits
The Search API is rate-limited per application. Current limits:
- Search queries: 100 requests per second
- Management API: 10 requests per second
Need Higher Limits?
Contact our sales team if you need higher rate limits for your application.