curl -X GET "https://prod.visionapi.unsiloed.ai/classify/47c536aa-9fab-48ca-b27c-2fd74d30490a" \
-H "api-key: your-api-key" \
-H "Content-Type: application/json"
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "processing",
"progress": "Processing page 1 of 2",
"error": null,
"result": null
}
Check the status and progress of classification jobs and retrieve results
curl -X GET "https://prod.visionapi.unsiloed.ai/classify/47c536aa-9fab-48ca-b27c-2fd74d30490a" \
-H "api-key: your-api-key" \
-H "Content-Type: application/json"
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "processing",
"progress": "Processing page 1 of 2",
"error": null,
"result": null
}
Show result_structure
curl -X GET "https://prod.visionapi.unsiloed.ai/classify/47c536aa-9fab-48ca-b27c-2fd74d30490a" \
-H "api-key: your-api-key" \
-H "Content-Type: application/json"
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "processing",
"progress": "Processing page 1 of 2",
"error": null,
"result": null
}
processing
completed
failed
import time
import asyncio
async def poll_classification_status(job_id, max_wait_time=300):
"""Poll classification job status with exponential backoff"""
base_delay = 1 # Start with 1 second
max_delay = 30 # Maximum delay between polls
current_delay = base_delay
total_wait_time = 0
while total_wait_time < max_wait_time:
try:
response = requests.get(
f"https://prod.visionapi.unsiloed.ai/classify/{job_id}",
headers={"api-key": "your-api-key", "Content-Type": "application/json"}
)
if response.status_code == 200:
result = response.json()
if result['status'] == 'completed':
return result['result']
elif result['status'] == 'failed':
raise Exception(f"Classification failed: {result.get('error', 'Unknown error')}")
else:
print(f"Status: {result['status']}, Progress: {result.get('progress', 'N/A')}")
# Wait before next poll
await asyncio.sleep(current_delay)
total_wait_time += current_delay
# Exponential backoff
current_delay = min(current_delay * 2, max_delay)
except Exception as e:
print(f"Error polling status: {e}")
await asyncio.sleep(current_delay)
total_wait_time += current_delay
raise Exception("Classification job timed out")
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "failed",
"progress": "Classification failed",
"error": "Failed to process PDF: File appears to be corrupted",
"result": null
}
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "failed",
"progress": "Classification failed",
"error": "Invalid conditions format. Must be a valid JSON string.",
"result": null
}
{
"job_id": "47c536aa-9fab-48ca-b27c-2fd74d30490a",
"status": "failed",
"progress": "Classification failed",
"error": "Failed to upload file to storage. Please try again.",
"result": null
}
The unique identifier of the classification job
Classification job status retrieved successfully