Classifier Label Created Event
Webhook event fired when a classifier creates a new label for a document type it has not seen before.
The CLASSIFIER_LABEL_CREATED event fires when a classifier creates a new label. Every classified document carries a label -- its document type, such as "Invoice" or "Purchase Order". When a document matches no route and none of the existing labels fits, the classifier can create a new one.
This event only covers labels the classifier creates itself. Labels a person creates in the app or through the labels API do not fire it. Route labels, which exist as soon as the route does, do not fire it either.
When It Triggers
- New document type -- a document did not route, no existing label fit, and the classifier created one
The classifier does not create labels when its allowNewLabels setting is off, or while the hard label limit is reached. In those cases this event does not fire.
Routing
This is a classifier event, routed to subscriptions by classifier route, like DOCUMENT_CLASSIFIED.
classificationId and fileId identify the classification run and the file that produced the label. That same document's DOCUMENT_CLASSIFIED event carries the label with data.label.isNew set to true, so you can correlate the two by classificationId or by data.label.id.
Payload Structure
{
"eventId": "evt_lblcreated_201",
"eventType": "CLASSIFIER_LABEL_CREATED",
"timestamp": "2024-01-15T10:32:11Z",
"organizationId": "org_xyz789",
"projectId": "proj_abc123",
"classifierId": "clf_123abc",
"classificationId": "cls_789jkl",
"fileId": "file_012mno",
"data": {
"label": {
"id": "lbl_cus002",
"name": "Customs Declaration",
"description": "Import declaration listing goods, tariff codes and declared values"
}
}
}Payload Fields
| Field | Type | Description |
|---|---|---|
eventId | string | Unique event identifier. Use for idempotency. |
eventType | string | Always "CLASSIFIER_LABEL_CREATED" |
timestamp | ISO 8601 | When the label was created (UTC) |
organizationId | string | Your organization identifier |
projectId | string | The project the classifier belongs to. See the note below for global classifiers. |
classifierId | string | The classifier that created the label |
classificationId | string | The classification run that produced the label |
fileId | string | The file that produced the label |
data.label.id | string | The new label's id |
data.label.name | string | The new label's name |
data.label.description | string | null | The classifier's description of the document type, if it wrote one |
projectId for a global classifier
A global classifier is shared across every project in your organization, so a new label belongs to no single project. Each subscription receives its own projectId -- the project the webhook is configured in. classifierId and data.label.id are the same for every subscriber.
Handling the Event
function handleClassifierLabelCreated(event) {
const { classifierId, fileId, data } = event
console.log(`Classifier ${classifierId} created label "${data.label.name}" from ${fileId}`)
queueLabelReview(classifierId, data.label.id)
}Notes
Review new labels as they arrive. The classifier may create near-duplicates ("Invoice" and "Supplier Invoice") or names you would phrase differently. Renaming or merging them early, in the app or through the labels API, keeps the set small and keeps later documents landing on the right label. Active labels that are not route labels count toward the label limits.