This endpoint provides a unified interface for both creating new annotations and updating existing ones. The behavior is determined by whether you include the annotationId
parameter.
Usage
Create new annotation : Omit the annotationId
parameter to create a new annotation
Update existing annotation : Include the annotationId
parameter to update an existing annotation
Request Body
The ID of the job the annotation belongs to
The annotated data with human corrections
ID of an existing annotation to update. If provided, the endpoint will update
an existing annotation. If omitted, a new annotation will be created.
The ID of the extract job associated with this annotation
The ID of the extract example associated with this annotation
Response
Whether the annotation was saved successfully
The saved annotation data URL of the annotated document
The original extracted data
The annotated data with corrections
When the annotation was created
When the annotation was last updated
Creating new annotations
Updating existing annotations
const options = {
method: "POST" ,
headers: {
"x-api-key" : "<your-api-key>" ,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
jobId: "123e4567-e89b-12d3-a456-426614174000" ,
annotatedData: {
name: "John Doe" ,
amount: "1500" ,
},
extractId: "123e4567-e89b-12d3-a456-426614174002" ,
}),
};
fetch ( "https://api.getomni.ai/extract-annotations" , options )
. then (( response ) => response . json ())
. then (( response ) => console . log ( response ))
. catch (( err ) => console . error ( err ));
{
"success" : true ,
"annotation" : {
"jobId" : "123e4567-e89b-12d3-a456-426614174000" ,
"documentUrl" : "https://example.com/document.pdf" ,
"originalData" : {
"name" : "John Doe" ,
"amount" : "1000"
},
"annotatedData" : {
"name" : "John Doe" ,
"amount" : "1500"
},
"createdAt" : "2023-09-10T14:23:45.123Z" ,
"updatedAt" : "2023-09-10T14:23:45.123Z"
}
}