Learn how to monitor the processing status of your documents
curl "https://api.invaro.ai/api/v1/parse/invoices/{job_id}" \ -H "Authorization: Bearer your_api_key"
const response = await fetch(`https://api.invaro.ai/api/v1/parse/invoices/${job_id}`, { headers: { 'Authorization': 'Bearer your_api_key' } }); const data = await response.json(); const status = data.data.status;
{ "success": true, "data": { "job_id": "job_1739261168870934041", "status": "completed", // or "processing", "pending", "failed" "file_id": "sample_document.pdf", "created_at": "2024-01-07T10:00:00Z", "updated_at": "2024-01-07T10:01:00Z", "progress": 100, "results": { // Processed document data } } }
async function pollStatus(jobId, docType = 'invoices') { while (true) { const response = await fetch(`https://api.invaro.ai/api/v1/parse/${docType}/${jobId}`, { headers: { 'Authorization': 'Bearer your_api_key' } }); const data = await response.json(); const status = data.data.status; if (status === 'completed') { return data.data.results; } else if (status === 'failed') { throw new Error('Processing failed'); } // Wait 5 seconds before next check await new Promise(resolve => setTimeout(resolve, 5000)); } }