POST
/
classification
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
}

This API endpoint allows users to create a classification, along with classification options and file examples.

Body Parameters

name
string
required

Name of the classification.

options
array
required

Array of classification options. A NO_MATCH option is automatically added when no predefined categories apply.

Response

id
string

Unique identifier for the created classification.

success
boolean

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
}