Autocomplete
curl --request GET \
--url https://api.example.com/api/v1/autocomplete{
"suggestions": [
{}
],
"processingTimeMs": 123,
"products": [
{}
]
}Autocomplete
Get type-ahead search suggestions with document counts
GET
/
api
/
v1
/
autocomplete
Autocomplete
curl --request GET \
--url https://api.example.com/api/v1/autocomplete{
"suggestions": [
{}
],
"processingTimeMs": 123,
"products": [
{}
]
}Returns term suggestions from the pre-aggregated search suggestions index. Optimized for sub-50ms response times with Redis caching.
Authentication
All requests must include an API key via thex-api-key header or key query parameter.
curl "https://alana.shopping/api/v1/autocomplete?query=cam" \
-H "x-api-key: ak_your_api_key"
Query Parameters
Search prefix (minimum 2 characters). Returns empty suggestions for single-character queries.
Maximum number of suggestions returned. Capped at 10.
Include top 3 matching products when available from cache. Products are only returned on cache hit — never triggers a live search query.
API key as query parameter (alternative to
x-api-key header).Response
Array of suggestion objects ordered by document count descending.
Server-side processing time in milliseconds.
Optional product previews. Only present when
include_products=true and cache is warm.AutocompleteSuggestion
| Field | Type | Description |
|---|---|---|
| text | string | Suggestion term |
| count | integer | Number of products matching this term |
Example
curl "https://alana.shopping/api/v1/autocomplete?query=camis&limit=5" \
-H "x-api-key: ak_your_api_key"
{
"suggestions": [
{ "text": "camiseta", "count": 142 },
{ "text": "camiseta azul", "count": 38 },
{ "text": "camiseta polo", "count": 24 },
{ "text": "camiseta branca", "count": 19 },
{ "text": "camiseta oversized", "count": 11 }
],
"processingTimeMs": 6
}
Rate Limits
1000 requests per minute per API key.Error Codes
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Missing or empty query parameter |
| 401 | Unauthorized | Invalid or missing API key |
| 429 | Rate Limited | Exceeded 1000 req/min per API key |
Última modificação em 12 de março de 2026
⌘I