Skip to main content
POST
https://api.classer.ai
/
v1
/
classify
Classify
curl --request POST \
  --url https://api.classer.ai/v1/classify \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "<string>",
  "labels": [
    "<string>"
  ],
  "descriptions": {},
  "model": "<string>"
}
'
{
  "label": "technical",
  "confidence": 0.9423,
  "latency_ms": 142,
  "usage": {
    "prompt_tokens": 38,
    "completion_tokens": 1,
    "total_tokens": 39
  }
}

Request

source
string
required
The text to classify
labels
string[]
required
List of possible labels (1-26 labels)
descriptions
object
Optional descriptions for each label to improve accuracy
model
string
Model override (optional)

Response

label
string
The predicted label
confidence
number
Confidence score between 0 and 1
latency_ms
number
Processing time in milliseconds
usage
object
Token usage information

Examples

Basic classification

import classer

result = classer.classify(
    source="I can't log in to my account",
    labels=["billing", "technical", "sales"]
)

print(result.label)      # "technical"
print(result.confidence) # 0.94

With descriptions

Adding descriptions improves accuracy for ambiguous labels:
result = classer.classify(
    source="We need pricing for 500 users",
    labels=["hot", "warm", "cold"],
    descriptions={
        "hot": "Ready to buy, asking for pricing or demo",
        "warm": "Interested but still exploring",
        "cold": "Just browsing, no clear intent"
    }
)

print(result.label)  # "hot"
{
  "label": "technical",
  "confidence": 0.9423,
  "latency_ms": 142,
  "usage": {
    "prompt_tokens": 38,
    "completion_tokens": 1,
    "total_tokens": 39
  }
}