---
title: Overview of Classify | Developer Documentation
description: Learn what the Classification API is, how rules work, and how to run classifications using the client SDK.
---

Using a coding agent?

Give your AI agent access to these docs: `claude mcp add llama-index-docs --transport http https://developers.llamaindex.ai/mcp` — or supercharge your agent with LlamaParse [MCP tools and Skills](/for-agents/index.md).

Classify lets you automatically categorize documents into types you define (for example: invoice, receipt, contract) using natural-language rules.

## Use Cases

- **Use as a pre-processing step**

  - **Before extraction**: Classify first, then run schema-specific extraction (e.g., invoice vs. contract) with different LlamaExtract agents to improve accuracy and reduce cost.
  - **Before parsing**: Classify first, then run LlamaParse over labeled files with finely tuned parse settings for each classified category to improve accuracy and reduce cost.
  - **Before indexing**: Classify first, then send classified files into appropriate LlamaCloud indices with tailored chunking, metadata, and access controls to improve retrieval quality.

- **Intake routing for back-office documents**: Auto-separate invoices, receipts, purchase orders, and bank statements to the right queues, storage buckets, or approval workflows.

- **Dataset curation**: Auto-tag large archives into meaningful categories to create labeled subsets for model training.

## Concepts

- **Rule**: A content-based criterion for a document type. Each rule has:

  - `type`: the label to assign. Must contain only alphanumeric characters, spaces, hyphens, and underscores. For example: “invoice”, “sec\_filing”, “Tax Return”, “10-K”.
  - `description`: a natural-language description of the content that should match this type.

- **Parsing configuration (optional)**: Controls how we parse documents before classification (e.g., language, page limits). Useful for speed/accuracy tradeoffs.

- **Results**: For each file you get a `type` (predicted), `confidence` (0.0–1.0), and `reasoning` (step-by-step explanation).

## Typical flow

1. Upload your files to LlamaCloud

2. Create rules for your target classes

3. Create a classify job with the file ids and rules

4. Fetch results and consume the predictions

## Next steps

- Make sure you have an API key: [Get an API key](../../cloud/general/api_key)
- Jump straight to the SDK guide to run your first job using [the SDK](./sdk)
- For use with other languages, see our [API reference](https://developers.llamaindex.ai/reference/resources/classify/)
