---
title: "Predict Answer"
method: POST
path: "/api/v1/datasets/{datasetId}/predict-answer"
tags: ["FAQ"]
---

# Predict Answer

`POST /api/v1/datasets/{datasetId}/predict-answer`

Predicts an answer corresponding to a question which is possibly contained in the phrase given an FAQ dataset. The FAQ API uses machine learning to generalize from the questions and answers in the dataset to infer the answer of the given question. This requires the active model for the dataset to be trained. Training a model usually takes around 1 minute after a dataset is created or updated. This endpoint yields an error if the model has not been trained yet.

## Path parameters

- `datasetId` string, required

## Request body

- object — A request for predicting an answer from a phrase and a dataset ID.
  - `phrase` string — The phrase that might contain a question to be answered.

## Response `200`

A successful response.

- V1PredictAnswerResponse — A response that contains the answer and its related metadata, such as a URL pointing to more details. If the FAQ API could not find a corresponding answer, the answer field will not be populated.
  - `answer` V1Answer — An answer which corresponds to one or more example questions in the dataset.
    - `text` string — The text containing the answer.
    - `url` string — The URL with additional information for this answer.
    - `title` string — The short title representing the answer.
  - `answerPredicted` boolean — Indicates if an answer was predicted. If `false`, the phrase could not be matched with an answer.

## Other responses

- `401` — Returned when the user is not authorized.
- `404` — Returned when the resource does not exist.
- `default` — An unexpected error response.

---

[API](https://skmtc.net/messagebird/apis/faq.md) · [All operations](https://skmtc.net/messagebird/apis/faq/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/messagebird/faq/versions/6af420f89657/schema)
