# Classify (/docs/classify)

Tell Pagelet what makes a document a bank statement, paystub, or another category relevant to your workflow. Classification checks the recovered content against your criteria. A document can match more than one category.

Classification is included in every plan. It is separate from Search access.

## Define what should match [#define-what-should-match]

Give each category a name and describe the evidence you expect to find. For example:

```js
const documentTypes = [
  { category: "Bank statement", criteria: ["Lists bank account transactions and opening and closing balances."] },
  { category: "Paystub", criteria: ["Shows an employee's earnings, deductions, and pay period."] },
]
```

Choose criteria that describe the document's content. Categories are yours to define; there is no fixed list of document types to choose from.

## Classify a document [#classify-a-document]

In the portal, open a document and select **Classify** or **Edit criteria** under **Classifications**. Enter your categories and criteria, then select **Classify**. Matching tags appear when the request finishes. The [portal walkthrough](/docs/portal-quickstart#4-classify-your-document) shows the editor.

With the SDK, include your criteria when creating a document. Follow the [SDK quickstart](/docs/sdk-quickstart) to install the package and configure your client:

```js
const result = await client.documents.create({
  file: "statement.pdf",
  classification: documentTypes,
})

console.log(result.classification?.categories)
```

This waits for content recovery and the requested classification. If classification fails, the recovered content remains available with a warning. Check the classification status before treating its categories as a completed result.

To classify an existing document, use [`classifications.create`](/docs/sdk-reference#classificationscreate), then read that request with [`classifications.get`](/docs/sdk-reference#classificationsget). You do not need to upload the file again.

## Understand the result [#understand-the-result]

| Portal result                       | Meaning                                                            |
| ----------------------------------- | ------------------------------------------------------------------ |
| **Not classified**                  | No classification has been requested                               |
| **Classifying…**                    | The request is waiting or in progress                              |
| **Category tags**                   | Categories that matched the document                               |
| **No matches in evaluated content** | No category matched the content that was checked                   |
| **Classification failed**           | The request could not finish; open the document for an explanation |

In SDK and API responses, `categories: []` is a completed no-match result. `categories: null` means there is no completed result. `evaluated_pages` identifies which pages were checked; classification does not necessarily evaluate every page in a long document.

The editor's **Matched** marker applies only while a category's name and criteria remain unchanged. Editing criteria does not apply them until you submit a classification request.

You can use **Categories** in the document library to find documents with matching tags. Classification failure does not remove recovered pages or prevent you from reviewing them.

## Reuse your criteria [#reuse-your-criteria]

The workspace owner can save [classification defaults](/docs/workspace-and-team#classification-defaults) for future uploads. An SDK upload inherits those defaults when you omit `classification`. Supply different criteria to override them, or `classification: null` to skip classification for that upload.

Changing defaults leaves existing documents unchanged. Classify an existing document again when you want to apply different criteria.

The [SDK reference](/docs/sdk-reference#classificationscreate) covers permissions, active requests, and status reads. Recovery webhooks announce content recovery; they do not announce classification completion.
