Autocomplete
curl --request GET \
--url https://api.example.com/api/v1/autocompleteimport requests
url = "https://api.example.com/api/v1/autocomplete"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/autocomplete', 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://api.example.com/api/v1/autocomplete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/autocomplete"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/autocomplete")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/autocomplete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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/autocompleteimport requests
url = "https://api.example.com/api/v1/autocomplete"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/autocomplete', 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://api.example.com/api/v1/autocomplete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/autocomplete"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/autocomplete")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/autocomplete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
string
obrigatório
Search prefix (minimum 2 characters). Returns empty suggestions for single-character queries.
integer
padrão:"5"
Maximum number of suggestions returned. Capped at 10.
boolean
padrão:"false"
Include top 3 matching products when available from cache. Products are only returned on cache hit — never triggers a live search query.
string
API key as query parameter (alternative to
x-api-key header).Response
AutocompleteSuggestion[]
Array of suggestion objects ordered by document count descending.
integer
Server-side processing time in milliseconds.
SearchHit[]
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