Skip to main content
POST
/
v1
/
rubric
/
classify
Rubric Classify
curl --request POST \
  --url https://api.trynawa.com/v1/rubric/classify
Classify a comment against a custom rubric. Define your own categories and scoring criteria for domain-specific classification.
Cost: $0.003 per request (3 credits). 500 free requests/month on this endpoint — no credit card required. Semantic cache hits are free (X-NAWA-Cache: HIT).

Request

Body parameters

ParameterTypeRequiredDescription
textstringYesThe comment text to classify. Max 5,000 characters.
rubricobjectYesThe rubric definition with categories and criteria.
rubric.categoriesstring[]YesList of category names to classify against.
rubric.descriptionsobjectNoCategory descriptions to guide the model. Keys are category names, values are description strings.
platformstringNoSource platform for context.

Example request

curl -X POST https://api.trynawa.com/v1/rubric/classify \
  -H "Authorization: Bearer nawa_test_sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "وين الترجمة العربية؟ مافهمت شي",
    "rubric": {
      "categories": ["translation_request", "technical_issue", "content_feedback", "off_topic"],
      "descriptions": {
        "translation_request": "User is asking for subtitles or translation",
        "technical_issue": "Audio, video, or playback problems",
        "content_feedback": "Comments about the content quality",
        "off_topic": "Not related to the video"
      }
    },
    "platform": "youtube"
  }'

Response

Success response (200)

{
  "success": true,
  "result": {
    "text": "وين الترجمة العربية؟ مافهمت شي",
    "category": "translation_request",
    "category_confidence": 0.94,
    "scores": {
      "translation_request": 0.94,
      "technical_issue": 0.03,
      "content_feedback": 0.02,
      "off_topic": 0.01
    },
    "dialect": "gulf",
    "dialect_confidence": 0.91,
    "language": "ar",
    "model": "nagl-v1",
    "cached": false
  },
  "errors": [],
  "request_id": "req_rub123abc456"
}

Result fields

FieldTypeDescription
categorystringThe top matching category from your rubric
category_confidencenumberConfidence score (0–1) for the top category
scoresobjectConfidence scores for all rubric categories
dialectstringDetected Arabic dialect
dialect_confidencenumberDialect confidence score (0–1)
languagestringDetected language code
cachedbooleanWhether served from semantic cache