curl -X GET "https://prod.visionapi.unsiloed.ai/jobs/b2094b38-e432-44b6-a5d0-67bed07d5de1" \
-H "X-API-Key: your-api-key"
{
"id": "b2094b38-e432-44b6-a5d0-67bed07d5de1",
"status": "queued",
"type": "extraction",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"pdf_name": "financial_report.pdf",
"pdf_hash": "sha256:abc123...",
"user_id": "user_123"
}
Check the status and progress of asynchronous processing jobs
curl -X GET "https://prod.visionapi.unsiloed.ai/jobs/b2094b38-e432-44b6-a5d0-67bed07d5de1" \
-H "X-API-Key: your-api-key"
{
"id": "b2094b38-e432-44b6-a5d0-67bed07d5de1",
"status": "queued",
"type": "extraction",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"pdf_name": "financial_report.pdf",
"pdf_hash": "sha256:abc123...",
"user_id": "user_123"
}
curl -X GET "https://prod.visionapi.unsiloed.ai/jobs/b2094b38-e432-44b6-a5d0-67bed07d5de1" \
-H "X-API-Key: your-api-key"
{
"id": "b2094b38-e432-44b6-a5d0-67bed07d5de1",
"status": "queued",
"type": "extraction",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"pdf_name": "financial_report.pdf",
"pdf_hash": "sha256:abc123...",
"user_id": "user_123"
}
queued
PROCESSING
COMPLETED
/jobs/{job_id}/result endpoint.FAILED
error field for details.import time
import requests
def wait_for_job_completion(job_id, api_key, poll_interval=5, max_wait=300):
"""Wait for job to complete with polling"""
start_time = time.time()
headers = {"X-API-Key": api_key}
while time.time() - start_time < max_wait:
response = requests.get(f"https://prod.visionapi.unsiloed.ai/jobs/{job_id}", headers=headers)
if response.status_code == 200:
job = response.json()
status = job['status']
print(f"Job status: {status}")
if status == 'COMPLETED':
return job, True
elif status == 'FAILED':
return job, False
time.sleep(poll_interval)
raise TimeoutError(f"Job {job_id} did not complete within {max_wait} seconds")
# Usage
job_id = "your-job-id"
job, success = wait_for_job_completion(job_id, "your-api-key")
if success:
print("Job completed successfully!")
else:
print(f"Job failed: {job.get('error', 'Unknown error')}")
The unique identifier of the job to check