The platform
Classify
Label documents and split a file into its classes, with your own classes or ours.
A classification job reads a document and tells you what it is: an invoice, a delivery note, a contract. When one file holds several documents, the result also says which pages belong to which class.
Create a classification job
Section titled “Create a classification job”Without classes, ByteIt uses its default classes. To use your own, send classes as a list of
label and description pairs: only those classes are used. In a form upload, classes is one
field holding a JSON array.
curl -X POST "https://byteit.ai/v1/jobs/classification-jobs/" \ -H "X-API-Key: $BYTEIT_API_KEY" \ -F "file=@invoice.pdf" \ -F "nickname=inbox-batch"import os
from byteit import ByteIt, ClassificationClassEntryRequest
client = ByteIt(api_key=os.environ["BYTEIT_API_KEY"])
with open("inbox.pdf", "rb") as file: client.classification_jobs.create( file=file, classes=[ ClassificationClassEntryRequest( label="invoice", description="A bill requesting payment" ), ClassificationClassEntryRequest( label="contract", description="A signed agreement between parties" ), ], nickname="inbox-batch", )import * as fs from "fs";import { ByteItClient } from "@byteit/sdk";
const client = new ByteItClient({ apiKey: process.env.BYTEIT_API_KEY! });
await client.classificationJobs.create({ file: fs.createReadStream("inbox.pdf"), classes: [ { label: "invoice", description: "A bill requesting payment" }, { label: "contract", description: "A signed agreement between parties" }, ], nickname: "inbox-batch",});using ByteIt;
var client = new ByteItClient(Environment.GetEnvironmentVariable("BYTEIT_API_KEY")!);
await client.ClassificationJobs.CreateAsync( new CreateClassificationJobRequest { File = new FileParameter { Stream = File.OpenRead("inbox.pdf"), FileName = "inbox.pdf" }, Classes = new List<ClassificationClassEntryRequest> { new() { Label = "invoice", Description = "A bill requesting payment" }, new() { Label = "contract", Description = "A signed agreement between parties" }, }, Nickname = "inbox-batch", });The result
Section titled “The result”When the job is completed, the job’s document_class is the class of most of its pages, or mixed
on a tie. The result lists every page with its label and its group: pages with the same group
belong to the same document, so one scanned file splits into its documents.
{ "pages": [ { "page": 1, "label": "invoice", "group": 1 }, { "page": 2, "label": "invoice", "group": 1 }, { "page": 3, "label": "delivery_note", "group": 2 } ]}Manage your classes
Section titled “Manage your classes”Keep a set of document classes on your account and reuse them: create, list, update and delete them in Document classes.