Batch Classify
curl --request POST \
--url https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "msg_001",
"message": "Where is my order?"
},
{
"id": "msg_002",
"message": "I want a refund for order #4521"
},
{
"id": "msg_003",
"message": "Do you have this in blue?"
}
],
"top_k": 1
}
'import requests
url = "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch"
payload = {
"messages": [
{
"id": "msg_001",
"message": "Where is my order?"
},
{
"id": "msg_002",
"message": "I want a refund for order #4521"
},
{
"id": "msg_003",
"message": "Do you have this in blue?"
}
],
"top_k": 1
}
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({
messages: [
{id: 'msg_001', message: 'Where is my order?'},
{id: 'msg_002', message: 'I want a refund for order #4521'},
{id: 'msg_003', message: 'Do you have this in blue?'}
],
top_k: 1
})
};
fetch('https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch', 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/batch",
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([
'messages' => [
[
'id' => 'msg_001',
'message' => 'Where is my order?'
],
[
'id' => 'msg_002',
'message' => 'I want a refund for order #4521'
],
[
'id' => 'msg_003',
'message' => 'Do you have this in blue?'
]
],
'top_k' => 1
]),
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/batch"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\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/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch")
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 \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"results": [
{
"id": "<string>",
"top_intent": "<string>",
"confidence": 123
}
],
"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
Batch Classify
Classify multiple messages in a single request. Maximum 100 messages per request.
POST
/
intent-classify
/
batch
Batch Classify
curl --request POST \
--url https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "msg_001",
"message": "Where is my order?"
},
{
"id": "msg_002",
"message": "I want a refund for order #4521"
},
{
"id": "msg_003",
"message": "Do you have this in blue?"
}
],
"top_k": 1
}
'import requests
url = "https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch"
payload = {
"messages": [
{
"id": "msg_001",
"message": "Where is my order?"
},
{
"id": "msg_002",
"message": "I want a refund for order #4521"
},
{
"id": "msg_003",
"message": "Do you have this in blue?"
}
],
"top_k": 1
}
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({
messages: [
{id: 'msg_001', message: 'Where is my order?'},
{id: 'msg_002', message: 'I want a refund for order #4521'},
{id: 'msg_003', message: 'Do you have this in blue?'}
],
top_k: 1
})
};
fetch('https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch', 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/batch",
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([
'messages' => [
[
'id' => 'msg_001',
'message' => 'Where is my order?'
],
[
'id' => 'msg_002',
'message' => 'I want a refund for order #4521'
],
[
'id' => 'msg_003',
'message' => 'Do you have this in blue?'
]
],
'top_k' => 1
]),
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/batch"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\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/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehandled.io/api/v1/ipaas/inference/intent-classify/batch")
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 \"messages\": [\n {\n \"id\": \"msg_001\",\n \"message\": \"Where is my order?\"\n },\n {\n \"id\": \"msg_002\",\n \"message\": \"I want a refund for order #4521\"\n },\n {\n \"id\": \"msg_003\",\n \"message\": \"Do you have this in blue?\"\n }\n ],\n \"top_k\": 1\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"results": [
{
"id": "<string>",
"top_intent": "<string>",
"confidence": 123
}
],
"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
⌘I

