Skip to content

Autocomplete Suggestions

Auth required: Authorization: <main_api_key> or Authorization: <search_api_key> header.

Returns autocomplete suggestions based on the last word in the query. For example, searching "application pro" will suggest completions for "pro" (e.g. "programming", "process").

Suggestions do not consider sentence or phrase context.

Example

js
const { suggestions } = await client.suggest("posts", { q: "app" });
// ["apple", "application", "apricot"]
js
const res = await fetch("http://localhost:3000/collections/posts/suggest?q=app", {
  headers: { Authorization: "SecretApiKey" },
});
const { suggestions } = await res.json();
sh
# GET /collections/{collection_name}/suggest?q=app
#
# Response: 200 OK
# {
#   "suggestions": ["apple", "application", "apricot"]
# }

curl "http://localhost:3000/collections/posts/suggest?q=app" \
  -H "Authorization: SecretApiKey"

Endpoint Definition

FieldValue
MethodGET
Path/collections/{collection}/suggest

Query Parameters

ParamTypeDefaultDescription
qstringWord prefix to match (uses the last word if multiple)

Response Body

FieldTypeDescription
suggestionsarray of stringAutocomplete suggestions

Response: 200 OK