Classify Intent
curl --request POST \
--url https://api.usehandled.io/api/v1/ipaas/inference/intent-classify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "I placed an order yesterday but I want to cancel it now",
"conversation_history": [
{
"role": "customer",
"text": "Hi, I need some help with my order"
},
{
"role": "agent",
"text": "Of course! What can I help you with?"
}
],
"top_k": 3,
"threshold": 0.05
}
'import requests
url = "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify"
payload = {
"message": "I placed an order yesterday but I want to cancel it now",
"conversation_history": [
{
"role": "customer",
"text": "Hi, I need some help with my order"
},
{
"role": "agent",
"text": "Of course! What can I help you with?"
}
],
"top_k": 3,
"threshold": 0.05
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: 'I placed an order yesterday but I want to cancel it now',
conversation_history: [
{role: 'customer', text: 'Hi, I need some help with my order'},
{role: 'agent', text: 'Of course! What can I help you with?'}
],
top_k: 3,
threshold: 0.05
})
};
fetch('https://api.usehandled.io/api/v1/ipaas/inference/intent-classify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'I placed an order yesterday but I want to cancel it now',
'conversation_history' => [
[
'role' => 'customer',
'text' => 'Hi, I need some help with my order'
],
[
'role' => 'agent',
'text' => 'Of course! What can I help you with?'
]
],
'top_k' => 3,
'threshold' => 0.05
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify"
payload := strings.NewReader("{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"message": "<string>",
"predictions": [
{
"confidence": 0.5
}
],
"latency_ms": 123,
"model_version": "<string>"
}{
"error": "INVALID_REQUEST",
"message": "Missing required field: message",
"request_id": "req_err_001"
}{
"error": "UNAUTHORIZED",
"message": "Invalid or expired API token",
"request_id": "req_err_002"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}Intent Classification
Classify Intent
Accepts a customer message or conversation and returns the predicted intent with confidence scores.
POST
/
intent-classify
Classify Intent
curl --request POST \
--url https://api.usehandled.io/api/v1/ipaas/inference/intent-classify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "I placed an order yesterday but I want to cancel it now",
"conversation_history": [
{
"role": "customer",
"text": "Hi, I need some help with my order"
},
{
"role": "agent",
"text": "Of course! What can I help you with?"
}
],
"top_k": 3,
"threshold": 0.05
}
'import requests
url = "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify"
payload = {
"message": "I placed an order yesterday but I want to cancel it now",
"conversation_history": [
{
"role": "customer",
"text": "Hi, I need some help with my order"
},
{
"role": "agent",
"text": "Of course! What can I help you with?"
}
],
"top_k": 3,
"threshold": 0.05
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: 'I placed an order yesterday but I want to cancel it now',
conversation_history: [
{role: 'customer', text: 'Hi, I need some help with my order'},
{role: 'agent', text: 'Of course! What can I help you with?'}
],
top_k: 3,
threshold: 0.05
})
};
fetch('https://api.usehandled.io/api/v1/ipaas/inference/intent-classify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'I placed an order yesterday but I want to cancel it now',
'conversation_history' => [
[
'role' => 'customer',
'text' => 'Hi, I need some help with my order'
],
[
'role' => 'agent',
'text' => 'Of course! What can I help you with?'
]
],
'top_k' => 3,
'threshold' => 0.05
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify"
payload := strings.NewReader("{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"I placed an order yesterday but I want to cancel it now\",\n \"conversation_history\": [\n {\n \"role\": \"customer\",\n \"text\": \"Hi, I need some help with my order\"\n },\n {\n \"role\": \"agent\",\n \"text\": \"Of course! What can I help you with?\"\n }\n ],\n \"top_k\": 3,\n \"threshold\": 0.05\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"message": "<string>",
"predictions": [
{
"confidence": 0.5
}
],
"latency_ms": 123,
"model_version": "<string>"
}{
"error": "INVALID_REQUEST",
"message": "Missing required field: message",
"request_id": "req_err_001"
}{
"error": "UNAUTHORIZED",
"message": "Invalid or expired API token",
"request_id": "req_err_002"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}Authorizations
API token from your Handled dashboard
Body
application/json
The customer message or text to classify
Maximum string length:
2048Prior turns in the conversation for context
Show child attributes
Show child attributes
Number of top intents to return
Required range:
1 <= x <= 5Minimum confidence score to include in results
Required range:
0 <= x <= 1Response
Successful classification
Unique identifier for the inference request
The input message that was classified
Ranked list of intent predictions
Show child attributes
Show child attributes
The highest-confidence intent
Available options:
track_order, cancel_order, return_item, refund_request, product_inquiry, change_address, payment_issue, complaint, compliment, other Server-side inference time in milliseconds
Version of the model used
⌘I

