Limai Docs
API ReferenceClassification

Labels

List and create the labels a classifier uses to name document types.

A label names a document type, such as "Invoice" or "Purchase Order". Each classifier keeps its own set.

  • Every route has a label named after it, and a routed document carries its route's label. Renaming the route renames its label.
  • A document that matches no route still gets a label: an existing one when it fits, or a new one the classifier creates. The status UNCLASSIFIED therefore means classified but not routed, and the label says what the document is.
  • The classifier sees the current labels every time it runs, so it reuses them instead of inventing synonyms. Labels can be renamed, merged and archived in the app.

The classifier creates labels only while its allowNewLabels setting is on (the default) and it has fewer than 200 active labels outside its routes. At 50 it sends a CLASSIFIER_LABEL_LIMIT_REACHED notice; at 200 it stops creating labels until some are merged or archived.

List Labels

GET/api/v1/classify/{classifierId}/labels
NameTypeInRequiredDescription
classifierIdstringpathYesThe classifier ID.
includeArchivedbooleanqueryNoPass true to include archived labels. Defaults to false.
const response = await fetch(
`https://app.limai.io/api/v1/classify/${CLASSIFIER_ID}/labels`,
{ headers: { "Authorization": `Bearer ${API_TOKEN}` } }
)
const { labels } = await response.json()
Response200
{
  "labels": [
    {
      "id": "lbl_invoice01",
      "name": "Invoice",
      "description": null,
      "routeId": "route_123abc",
      "classificationCount": 412,
      "archivedAt": null,
      "createdAt": "2026-11-10T09:00:00.000Z",
      "updatedAt": "2026-11-10T09:00:00.000Z"
    },
    {
      "id": "lbl_po01",
      "name": "Purchase Order",
      "description": "Buyer-issued order listing goods, quantities and prices",
      "routeId": null,
      "classificationCount": 37,
      "archivedAt": null,
      "createdAt": "2026-11-11T14:20:00.000Z",
      "updatedAt": "2026-11-11T14:20:00.000Z"
    }
  ]
}

Labels are sorted by classificationCount, highest first, then by name. Labels merged into another label are never listed.

FieldTypeDescription
idstringLabel ID. Pass it as label to GET /classifications.
namestringDisplay name
descriptionstring | nullOne-line description. The classifier reads it when choosing a label.
routeIdstring | nullThe route this label belongs to, or null for a label outside the routes
classificationCountnumberHow many classifications carry this label
archivedAtISO 8601 | nullWhen the label was archived. Archived labels are not offered to the classifier.
createdAtISO 8601When the label was created
updatedAtISO 8601When the label last changed

Create a Label

POST/api/v1/classify/{classifierId}/labels

Add a label before the classifier meets that kind of document, so it uses your name from the first document on. Requires edit permission on the classifier. Labels you create do not fire CLASSIFIER_LABEL_CREATED; only labels the classifier creates do.

NameTypeInRequiredDescription
classifierIdstringpathYesThe classifier ID.
namestringbodyYesLabel name, 1 to 100 characters. Use the full, singular name of the document type, e.g. Purchase Order.
descriptionstring | nullbodyNoOne-line description the classifier reads when choosing a label.
const response = await fetch(
`https://app.limai.io/api/v1/classify/${CLASSIFIER_ID}/labels`,
{
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Purchase Order",
    description: "Buyer-issued order listing goods, quantities and prices"
  })
}
)
const label = await response.json()
Response201
{
  "id": "lbl_po01",
  "name": "Purchase Order",
  "description": "Buyer-issued order listing goods, quantities and prices",
  "routeId": null,
  "classificationCount": 0,
  "archivedAt": null,
  "createdAt": "2026-11-12T08:00:00.000Z",
  "updatedAt": "2026-11-12T08:00:00.000Z"
}

The response is a label with the same fields as in the list.

Errors

StatusWhen
400name is missing, empty, or longer than 100 characters
403You cannot edit this classifier
404The classifier does not exist or is not accessible
409A label with the same name already exists. Names are compared case-insensitively, ignoring punctuation and plurals, so "Purchase orders" conflicts with "Purchase Order".

On this page