This API endpoint allows users to create a classification, along with classification options and file examples.
Body Parameters
Name of the classification.
Array of classification options. A NO_MATCH
option is automatically added
when no predefined categories apply.
Name of the classification option.
Brief description of the classification option.
Array of example files associated with the classification option.
URL of the example file for classification.
Response
Unique identifier for the created classification.
Whether the classification was created successfully.
const options = {
method: "POST",
headers: {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Financial Document Classification",
options: [
{
name: "CREDIT_CARD_STATEMENT",
description: "Monthly summary of credit card transactions and payments",
examples: [{ url: "https://example.com/credit-card-statement.pdf" }],
},
{
name: "MORTGAGE_STATEMENT",
description:
"Monthly record of mortgage payments, interest, and escrow details",
examples: [{ url: "https://example.com/mortgage-statement.pdf" }],
},
],
}),
};
fetch("https://api.getomni.ai/classification", options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
{
"id": "62faa34f-1229-4d20-8008-ce1e7830397b",
"success": true
}