Free plan

Classify Document

Find out what kind of document a file is
POST
/v1/ai/documents/classify

About this tool

AI reads a file and decides which kind it is, such as invoice, contract, receipt or letter. You can give your own list of kinds to choose from. It also says how sure it is. The text is written by AI, so read it before you use it.
For example, you add a pile of scanned papers and see which are invoices and which are letters.

How to use it

  1. Choose this tool.
  2. Add up to 5 documents.
  3. If you like, type your own list of kinds to choose from.
  4. Press Generate.
  5. Read the answer and copy or download it.

What you get back

You get the chosen kind for each document and how sure the AI is. You can copy or download it.
TEST IT LIVE

Try Classify Document in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Free
Method
POST
Endpoint
/v1/ai/documents/classify
Tool ID
ai.documents.classify
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/documents/classify" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'on_unsupported=error' \
  -F 'quality=standard' \
  -F 'strategy=auto'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.documents.classify({
    "on_unsupported": "error",
    "quality": "standard",
    "strategy": "auto"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->documents()->classify([
    'on_unsupported' => 'error',
    'quality' => 'standard',
    'strategy' => 'auto',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Assign a document to a label (yours or generic). Readiness: unbenchmarked (see GET /v1/ai/capabilities/documents.classify).

Classification: hybrid. Deterministic stages: file type detection from content, native PDF text extraction (Poppler), Tesseract OCR for pages without text, page rendering for vision fallback, token budgeting and chunking.

Classify Document works from text and settings, so no file is needed. Every input is optional.

Classify Document is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/documents/classify with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.