Limai Docs
API ReferenceWebhooks

Classifier Label Limit Reached Event

Webhook event fired when a classifier's active labels cross the soft or hard limit.

The CLASSIFIER_LABEL_LIMIT_REACHED event fires when the number of active labels on a classifier crosses one of two limits. Only labels that are not route labels count; route labels never count toward either limit.

When It Triggers

  • Soft limit -- the classifier reaches 50 active non-route labels. data.limit is "soft". This is informational: the classifier keeps working as before. It is a good moment to review, rename and merge labels.
  • Hard limit -- the classifier reaches 200 active non-route labels. data.limit is "hard". The classifier stops creating labels, and behaves as if allowNewLabels were off: a document that matches no route gets an existing label or none. Label creation resumes once you merge or archive enough labels to drop below the limit.

The event is sent once per crossing. While the count stays at or above a limit, no further events are sent for it. If the count drops back below the limit and crosses it again, the event is sent again.

Routing

This is a classifier event, routed to subscriptions by classifier route, like DOCUMENT_CLASSIFIED.

The limit belongs to the classifier, not to a document, so the payload carries no classificationId or fileId.

Payload Structure

Response200
{
  "eventId": "evt_lbllimit_301",
  "eventType": "CLASSIFIER_LABEL_LIMIT_REACHED",
  "timestamp": "2024-01-15T10:33:40Z",
  "organizationId": "org_xyz789",
  "projectId": "proj_abc123",
  "classifierId": "clf_123abc",
  "data": {
    "activeLabelCount": 50,
    "limit": "soft",
    "threshold": 50
  }
}

Payload Fields

FieldTypeDescription
eventIdstringUnique event identifier. Use for idempotency.
eventTypestringAlways "CLASSIFIER_LABEL_LIMIT_REACHED"
timestampISO 8601When the limit was crossed (UTC)
organizationIdstringYour organization identifier
projectIdstringThe project the classifier belongs to. For a global classifier, each subscription receives its own project.
classifierIdstringThe classifier that crossed the limit
data.activeLabelCountnumberActive non-route labels on the classifier when the limit was crossed
data.limit"soft" | "hard"Which limit was crossed
data.thresholdnumberThe limit's value: 50 for soft, 200 for hard

Handling the Event

function handleClassifierLabelLimitReached(event) {
const { classifierId, data } = event

if (data.limit === "hard") {
  console.error(`Classifier ${classifierId} stopped creating labels at ${data.activeLabelCount}`)
  alertOnCall(classifierId)
  return
}

console.warn(`Classifier ${classifierId} has ${data.activeLabelCount} labels; review and merge`)
}

Notes

While the hard limit is reached, documents that fit no existing label are left without one (data.label is null on DOCUMENT_CLASSIFIED). Merge near-duplicates or archive unused labels in the app or through the labels API to bring the count down.

On this page