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
Unique identifier of the classification to use.
URL of the document to classify. Required if a file is not provided.
A file to classify. Use multipart/form-data
as the Content-Type header.
Required if a URL is not provided.
Response
The classification result containing the selected category. Unique identifier for the classification option.
Name of the classification option.
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"
}
}