POST
/
classify
const options = {
  method: "POST",
  headers: {
    "x-api-key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    classificationId: "<classification-id>",
    url: "https://example.com/document.pdf",
  }),
};

fetch("https://api.getomni.ai/classify", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));
{
  "result": {
    "id": "4e3598e3-3ee2-423b-820e-176f4547ac4b",
    "name": "BANK_STATEMENT"
  }
}

This API endpoint processes a document (either a file or a URL) and assigns it a classification based on predefined categories. If the document does not match any predefined category, the response will return NO_MATCH as the classification result.

Body Parameters

classificationId
string
required

Unique identifier of the classification to use.

url
string

URL of the document to classify. Required if a file is not provided.

file
file

A file to classify. Use multipart/form-data as the Content-Type header. Required if a URL is not provided.

Response

result
object

The classification result containing the selected category.

const options = {
  method: "POST",
  headers: {
    "x-api-key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    classificationId: "<classification-id>",
    url: "https://example.com/document.pdf",
  }),
};

fetch("https://api.getomni.ai/classify", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));
{
  "result": {
    "id": "4e3598e3-3ee2-423b-820e-176f4547ac4b",
    "name": "BANK_STATEMENT"
  }
}