Skip to main content
POST
/
api
/
classify
Classify
curl --request POST \
  --url https://whetdata.com/api/classify \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "This is a great product with awesome features",
  "criteria": [
    "is_positive"
  ]
}
'
{
  "success": true,
  "scores": {
    "is_positive": 80
  }
}

Overview

Classify text against custom criteria. It analyzes your text and provides scores (0-100) for each specified criterion, indicating how well the text matches each criteria.

Use This Action To

  • Evaluate text against custom criteria
  • Score content based on specific attributes
  • Classify documents by custom metrics
  • Measure how well text matches defined criteria

Parameters

text
string
required
Text to classify (max 5,000 characters)
criteria
array
required
Array of criteria names to evaluate the text against

Example

cURL
curl -X POST https://whetdata.com/api/classify \
  -H "x-api-key: whet_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This is a great product with awesome features",
    "criteria": ["is_positive"]
  }'
JavaScript
const url = "https://whetdata.com/api/classify";
const options = {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "whet_your_api_key_here",
  },
  body: JSON.stringify({
    text: "This is a great product with awesome features",
    criteria: ["is_positive"],
  }),
};

fetch(url, options)
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response

{
  "success": true,
  "scores": {
    "is_positive": 100,
    "would_order_again": 100,
    "mentions_taste": 100,
    "is_actionable": 1
  }
}

Tips

The maximum text length is 5,000 characters. For longer texts, split them into chunks.

Body

application/json
text
string
required

Text to classify (max 5,000 characters)

Maximum string length: 5000
criteria
string[]
required

Array of criteria names to evaluate the text against

Response

200 - application/json

Success

success
boolean
scores
object

Scores for each criterion (0-100)