---
title: "Predict an intent for a phrase given a dataset"
method: POST
path: "/api/v1/datasets/{datasetId}/predict"
tags: ["Intent"]
---

# Predict an intent for a phrase given a dataset

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

Predicts an intent for a phrase given a dataset ID. The Intent API uses machine learning to generalize from the intents and phrases in the dataset that was created in the [datasets overview](https://dashboard.messagebird.com/knowledge-base-list) to infer the intent of the given `phrase`. Requires the active model for the dataset to be trained. 

Training a model usually takes around 1 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 intent from a phrase and a dataset ID.
  - `phrase` string — The phrase that might contain an intent.

## Response `200`

A successful response.

- V1PredictIntentResponse — A response for predicting an intent from a phrase and a dataset ID.
  - `intent` string — The intent that is predicted for the given phrase.
  - `intentPredicted` boolean — Boolean indicating an intent was predicted. If false the phrase could not be matched with an intent.

## 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/intent.md) · [All operations](https://skmtc.net/messagebird/apis/intent/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/messagebird/intent/versions/b1f6facbe19c/schema)
