6. Get results
POST
/documentClassification/getResults
This endpoint retrieves the classification results for a specific batch of documents.
By providing the classificationId
and batchId
, you can obtain the predicted document types for each file in the batch,.
Optionally, including a fileId
will return results for that specific file only. This is useful for retrieving targeted results without querying the entire batch.
Server URL
https://api.extracta.ai/api/v1
Headers
Name
Value
Content-Type
application/json
Authorization
Bearer <token>
Body
Name
Type
Required
Description
classificationId
string
true
The ID of the classification.
batchId
string
true
The ID of the batch.
fileId
string
false
The ID of the file.
Body Example
{
"classificationId": "classificationId",
"batchId": "batchId",
"fileId": "fileId" // optional
}
â ī¸ Important
To avoid rate-limiting, please ensure a delay of 2 seconds between consecutive requests to this endpoint.
Code Example
const axios = require('axios');
async function getClassificationResults(token, classificationId, batchId, fileId) {
const url = "https://api.extracta.ai/api/v1/documentClassification/getResults";
try {
const payload = {
classificationId,
batchId
};
if (fileId) {
payload.fileId = fileId;
}
const response = await axios.post(url, payload, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
return response.data;
} catch (error) {
throw error.response ? error.response.data : new Error('An unknown error occurred');
}
}
async function main() {
const token = 'apiKey';
const classificationId = 'classificationId';
const batchId = 'batchId';
const fileId = null; // or provide a specific file ID
try {
const results = await getClassificationResults(token, classificationId, batchId, fileId);
console.log("Classification Results:", results);
} catch (error) {
console.error("Failed to retrieve classification results:", error);
}
}
main();
Responses
{
"status": "success",
"classificationId": "classificationId",
"batchId": "batchId",
"files": [
{
"fileId": "fileId1",
"fileName": "File 1.pdf",
"status": "processed",
"result": {
"confidence": 0.9,
"documentType": "invoice"
},
"url": "fileUrl"
},
{
"fileId": "fileId2",
"fileName": "File 2.pdf",
"status": "processed",
"result": {
"confidence": 0.95,
"documentType": "other"
},
"url": "fileUrl"
},
...
]
}
Last updated
Was this helpful?