API Reference

Endpoint

POSThttps://api.ai-autocomplete.com/api/suggest

Headers

PropTypeDescription
AuthorizationRequired"Bearer <token>"Public key, secret key, or short-lived access token. All three are sent the same way.
Content-TypeRequired"application/json"Always application/json.

Request body

Top-level object with two halves — data (the autocomplete state) and meta (request envelope).

Autocomplete is a loop. On every keystroke send the current raw_query plus the running completed_params list. When the user picks an option from the previous response's suggestions, your client (a) replaces the chosen text in raw_query with a placeholder token like "{{TYPE_1}}" (the type name uppercased + a per-type counter), and (b) appends an entry to completed_params recording { placeholder, type, text }. The server resolves placeholders against completed_params to reconstruct the user's intent. See the Getting Started worked example.

PropTypeDescription
data.raw_querystringThe query you send, with each picked value replaced by its {{TYPE_N}} placeholder (e.g. "Create a {{TYPE_1}}") — distinct from the display string the user sees, which keeps the real values. completed_params maps each placeholder back to its text. The server accepts an empty string for the initial-state request.
data.completed_paramsCompletedParam[]One entry per placeholder token in raw_query. Each entry maps a placeholder (e.g. "{{TYPE_1}}") to its type and the chosen text. Omit when raw_query has no placeholders.
data.completed_params[].placeholderstringToken in raw_query this entry fills — e.g. "{{TYPE_1}}".
data.completed_params[].typestringThe suggestion type that produced this param. Tenant-specific (e.g. "type", "contact", "automation").
data.completed_params[].textstringLiteral text shown to the user for this filled placeholder. Omit when you don't want the server to see the value (PII masking — the server then only sees the type).
meta.request_idRequiredstring (UUID)UUIDv4. Echoed back in the response for log correlation.
meta.request_atRequiredstring (ISO 8601)ISO 8601 timestamp with timezone (e.g. "2026-05-26T18:30:00Z") representing when the client assembled the request. Echoed back so the client can detect stale responses.
meta.session_idstring (UUIDv4)UUIDv4 grouping requests from the same user session — reuse across keystrokes, rotate after submit. The server auto-generates one and echoes it back if you don't send it.
meta.languagestring (e.g. "en-US")Optional. BCP-47 locale (e.g. "en-US", "pt-BR"). The server localizes suggestions when possible.
request.json
{
"data": {
"raw_query": "Create a {{TYPE_1}} for {{CONTACT_1}}",
"completed_params": [
{ "placeholder": "{{TYPE_1}}", "type": "type", "text": "email" },
{ "placeholder": "{{CONTACT_1}}", "type": "contact", "text": "Alex" }
]
},
"meta": {
"request_id": "5a0d1c1e-1b3f-4a9e-8a4f-001a1c3b7d20",
"request_at": "2026-05-26T18:30:00Z",
"session_id": "9e5b7c0e-2a1b-4f8e-9c2d-3e4f5a6b7c8d"
}
}

Response body

Mirrors the request shape — data (autocomplete output) and meta (echoed envelope).

PropTypeDescription
data.raw_querystringEcho of the raw_query you sent.
data.input[]InputSegment[]Server-parsed view of the current input — an "intent" segment for the user-typed prefix plus one segment per completed param. null when raw_query has no placeholders.
data.input[].typestringSegment type. "intent" for the user-typed prefix; otherwise the suggestion type that produced the filled placeholder (e.g. "type", "contact").
data.input[].textstringFor "intent" segments, the user-typed prefix (text before the first placeholder in raw_query). For filled-param segments, the placeholder token itself (e.g. "{{TYPE_1}}").
data.suggestions[]Suggestion[]Suggestions for what comes next — prompt hints, or selectable options the user can pick from.
data.suggestions[].typestringSuggestion type. "placeholder" is the initial prompt-hint suggestion; other values are param names produced by the model (e.g. "type", "automation", "contact").
data.suggestions[].textstringLabel or hint for this suggestion. For "placeholder" type suggestions, the prompt to display in the input (e.g. "Create a"). For other suggestions, the param's name (e.g. "type", "automation"). Not a {{TYPE_N}} token — your client mints those when constructing the next request.
data.suggestions[].optionsOption[]Tappable options for this suggestion. Omitted when there are no options to choose from.
data.suggestions[].options[].textstringDisplay text for the option.
data.suggestions[].options[].is_tappablebooleanWhether the option can be selected directly. False on hint/fallback rows like "or type something else…".
meta.request_idstringEcho of the request_id you sent. Use for log correlation.
meta.request_atstring (ISO 8601)ISO 8601 timestamp when the server returned.
meta.session_idstring (UUIDv4)Echo of the session_id you sent, or the one the server generated if you didn't send one.
response.json
{
"data": {
"raw_query": "Create a {{TYPE_1}} for {{CONTACT_1}}",
"input": [
{ "type": "intent", "text": "Create a", "state": "completed" },
{ "type": "type", "text": "{{TYPE_1}}", "state": "completed" },
{ "type": "contact", "text": "{{CONTACT_1}}", "state": "completed" }
],
"suggestions": [
{
"type": "automation",
"text": "automation",
"required": false,
"options": [
{ "text": "send draft for review", "is_tappable": true },
{ "text": "schedule for tomorrow", "is_tappable": true }
]
}
],
"is_ready": false
},
"meta": {
"request_id": "5a0d1c1e-1b3f-4a9e-8a4f-001a1c3b7d20",
"request_at": "2026-05-26T18:30:00Z",
"session_id": "9e5b7c0e-2a1b-4f8e-9c2d-3e4f5a6b7c8d"
}
}