Checking Processing Status

After submitting documents for processing, you can monitor their status using the job ID received in the processing response.

Status Endpoints

cURL
curl "https://api.invaro.ai/api/v1/parse/invoices/{job_id}" \
  -H "Authorization: Bearer your_api_key"
JavaScript
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;

Status Response

The API returns the current status of the processing job:

{
  "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
    }
  }
}

Status Values

  • pending - Job is queued for processing
  • processing - Document is being processed
  • completed - Processing finished successfully
  • failed - Processing failed

Implementing Status Polling

Here’s an example of how to implement status polling:

JavaScript
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));
  }
}

When polling for status, implement appropriate retry logic and error handling. We recommend polling every 5-10 seconds.

Next Steps

Code Examples

See complete code examples for the entire workflow