> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/smart-data-extraction/document-classification.md).

# Document Classification

Apryse's Document Classification engine helps you automatically assign predefined categories to PDF document pages based on their content and structure. It is a part of the Apryse Server SDK Smart Dat

{% hint style="info" %}
**Document Category updates!**

New in 11.12 categories for financial reports, government tenders, legal documents, manuals, patents, scientific journals, and technical drawings have been added
{% endhint %}

{% hint style="info" %}
**Requirements**

*These packages are required to use these features in production. Trial keys have unlimited access to all features*

<a href="https://apryse.com/capabilities#SmartDataExtraction" class="button primary">Package: Smart Data Extraction</a><a href="/core/learn-more/modules.md#data-extraction-module" class="button primary">Module: Data Extraction</a><a href="https://showcase.apryse.com/key-value-extraction" class="button primary">Live demo</a>
{% endhint %}

Document Classification is an AI-trained SDK API that identifies each file on upload, based on a predefined set of 24 categories, so you can:

* Validate intake.
* Route to the right workflow.
* Add metadata for processing later.

The output includes the predicted label with a confidence score in structured JSON for easy integration into your solution.

The benefits of using this feature include:

* Automatically identify document types from a predefined set of 24 categories such as invoices, receipts, IDs, budgets, contracts, and more.
* You decide the thresholds for automated routing or manual reviews.
* Provides easy integration into downstream workflows.

The 24 categories include:

* "advertisement"
* "budget"
* "email"
* "financial\_reports"
* "form"
* "government\_tenders"
* "id"
* "invoice"
* "legal\_documents"
* "letter"
* "manuals"
* "memo"
* "news\_article"
* "passport"
* "patents"
* "presentation"
* "questionnaire"
* "receipt"
* "resume"
* "scientific\_journals"
* "scientific\_publication"
* "scientific\_report"
* "specification"
* "technical\_drawing"

### JSON Output Specification

Refer to the following specifications to learn more about the output JSON format:

* [JSON Specification for Document Classification](https://sdk.apryse.com/api/classificationjson/index.html)

## Extract document classes as JSON file

Specify the name of the input PDF file and the name of the output JSON file, then select the Doc Classification engine:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
DataExtractionModule.ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule.DataExtractionEngine.e_doc_classification);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
DataExtractionModule::ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule::e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
DataExtractionModuleExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModuleE_DocClassification)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
DataExtractionModule.extractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule.DataExtractionEngine.e_doc_classification);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
await PDFNet.DataExtractionModule.extractData("Invoice.pdf", "Invoice_Classified.json", PDFNet.DataExtractionModule.DataExtractionEngine.e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
DataExtractionModule::ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule::e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
DataExtractionModule.ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule.e_DocClassification)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
DataExtractionModule.ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule::E_DocClassification)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
DataExtractionModule.ExtractData("Invoice.pdf", "Invoice_Classified.json", DataExtractionModule.DataExtractionEngine.e_doc_classification)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Extract document classes as JSON string

Specify the name of the input PDF file, then select the Doc Classification engine:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
string json = DataExtractionModule.ExtractData("Scientific_Publication.pdf", DataExtractionModule.DataExtractionEngine.e_doc_classification);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
UString json = DataExtractionModule::ExtractData("Scientific_Publication.pdf", DataExtractionModule::e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
json := DataExtractionModuleExtractData("Scientific_Publication.pdf", DataExtractionModuleE_DocClassification).(string)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
String json = DataExtractionModule.extractData("Scientific_Publication.pdf", DataExtractionModule.DataExtractionEngine.e_doc_classification);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const json = await PDFNet.DataExtractionModule.extractDataAsString('Scientific_Publication.pdf', PDFNet.DataExtractionModule.DataExtractionEngine.e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$json = DataExtractionModule::ExtractData("Scientific_Publication.pdf", DataExtractionModule::e_DocClassification);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
json = DataExtractionModule.ExtractData("Scientific_Publication.pdf", DataExtractionModule.e_DocClassification)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
json = DataExtractionModule.ExtractData("Scientific_Publication.pdf", DataExtractionModule::E_DocClassification)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim json As String = DataExtractionModule.ExtractData("Scientific_Publication.pdf", DataExtractionModule.DataExtractionEngine.e_doc_classification)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Optional Configurations

[Select OCR Language](/core/smart-data-extraction/workflow.md#select-ocr-language)

[Password-Protected PDFs](/core/smart-data-extraction/workflow.md#specify-pdf-password)

[Page Range](/core/smart-data-extraction/workflow.md#select-a-page-range)

[Minimum Confidence Threshold](/core/smart-data-extraction/workflow.md#minimum-confidence-threshold)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/core/smart-data-extraction/document-classification.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
