---
title: "Question Autocomplete API"
method: POST
path: "/v1/qa/question_autocomplete"
tags: ["Q&A APIs"]
---

# Question Autocomplete API

`POST /v1/qa/question_autocomplete`

Question Autocomplete is an important feature for Q&A applications. It not only saves your users from typing
the complete questions, but also showcases what questions your app is capable answering. This is important because
Q&A is an advanced search feature that not every user is familar with.

Miso generates autocomplete candidates from the question bank you uploaded (see [Question Bank Upload API](...)).
Given a partial question string, Question Autocomplete API will suggest question candidates that match the query
the user is typing.


For example, let's first upload three questions to the question bank:
```
POST /v1/qa/questions
{"data": [
    {"question": "What is python?"},
    {"question": "What is pypy?"},
    {"question": "How to sort a list in Python?"}
]}
```

Then, immediately after the above request finished, you can send the request below to get autocompletion
candidates for any partial query string. For example, if the query string the user types so far is *"what is p"*:

```
POST /v1/qa/question_autocomplete
{
    "q": "what is p",
    "rows": 5
}
```

The API will respond the completion candidates like the following:
```
{
    "data":
        "completions": [
            {"question": "What is python?"},
            {"question": "What is pypy?"}
        ]
    }
}
```

The API supports adaptive fuzzy matching such that even if there are typos in the query string, the API
is still able to return the question candidates with the correct spellings. For example, if the query string is
"*How to sorta*". The API is still able to match the completion candidate:
"*How to sort a list in Python?*"

The API is optimized for instant experience and has an average response time lower than 50ms.

## Request body

- QuestionAutocompleteRequest — Post question autocomplete request
  - `q` string, required — The query user has entered so far
  - `rows` integer — Number of autocomplete results to return.

## Response `200`

Successful Response

- QAAutocompleteResponse — Autocomplete Response
  - `message` string
  - `data` QAAutocompleteResponseBody, required — Autocomplete Response
    - `took` integer — Number of milliseconds Miso took to retrieve the results.
    - `miso_id` string, uuid — Miso-generated unique Id for each recommendation or search result. Maintaining this Id for subsequent page views is important to Miso's performance as we use `miso_id` to track and fine-tune the performance of personalization and search results. When a user clicks on a recommendation or search result, you should pass the associated `miso_id` to the next page view, and associate the `miso_id` with the interactions that take place on the page (e.g. `product_detail_page_view`, `add_to_cart`, `add_to_collection`, `like`, etc.). In this way, Miso will learn which recommendations work and which didn't. Example: ``` {"misoId": "123e4567-e89b-12d3-a456-426614174000"} ```
    - `completions` AppSchemasEngineApiResponseQuestion[], required
      - `question` string, required
      - `weight` number

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/miso/apis/miso-api.md) · [All operations](https://skmtc.dev/miso/apis/miso-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/miso/miso-api/revisions/f2fa5ba6025f/schema)
