GET
/
jobs
/
{job_id}
/
result
curl -X GET "https://visionapi.unsiloed.ai/jobs/b2094b38-e432-44b6-a5d0-67bed07d5de1/result" \
  -H "X-API-Key: your-api-key"
{
  "data": {
    "company_name": {
      "score": 0.9945,
      "value": "Acme Corporation",
      "bboxes": [
        {
          "bbox": [72, 100, 400, 140]
        }
      ],
      "page_no": 1
    },
    "financial_data": {
      "revenue": {
        "score": 0.9876,
        "value": "1250000",
        "bboxes": [
          {
            "bbox": [150, 250, 300, 280]
          }
        ],
        "page_no": 1
      },
      "profit": {
        "score": 0.9654,
        "value": "185000",
        "bboxes": [
          {
            "bbox": [150, 290, 300, 320]
          }
        ],
        "page_no": 1
      }
    },
    "min_confidence_score": 0.9654
  },
  "processing_time": 15.7,
  "detections": [
    {
      "class": "Title",
      "confidence": 0.95,
      "bbox": [72, 100, 400, 140],
      "page": 1
    },
    {
      "class": "Text",
      "confidence": 0.89,
      "bbox": [72, 150, 500, 200],
      "page": 1
    }
  ],
  "citations": [
    {
      "field": "company_name",
      "text": "Acme Corporation",
      "page": 1,
      "bbox": [72, 100, 400, 140]
    }
  ]
}

Overview

The Get Job Results endpoint retrieves the processed data from a completed job. This endpoint should only be called after confirming the job status is “COMPLETED” using the status endpoint.

Results are only available for completed jobs. Check job status first to ensure processing has finished.

Request

job_id
string
required

The unique identifier of the completed job

X-API-Key
string

API key for authentication (optional for some endpoints)

Response

The response structure depends on the job type (extraction, parsing, classification, etc.).

Extraction Job Results

data
object

The extracted data matching the provided JSON schema

processing_time
number

Total processing time in seconds

detections
array

Array of detected elements with bounding boxes and confidence scores

citations
array

Citation information for extracted data

visualization_paths
array

Paths to visualization images (if requested)

curl -X GET "https://visionapi.unsiloed.ai/jobs/b2094b38-e432-44b6-a5d0-67bed07d5de1/result" \
  -H "X-API-Key: your-api-key"
{
  "data": {
    "company_name": {
      "score": 0.9945,
      "value": "Acme Corporation",
      "bboxes": [
        {
          "bbox": [72, 100, 400, 140]
        }
      ],
      "page_no": 1
    },
    "financial_data": {
      "revenue": {
        "score": 0.9876,
        "value": "1250000",
        "bboxes": [
          {
            "bbox": [150, 250, 300, 280]
          }
        ],
        "page_no": 1
      },
      "profit": {
        "score": 0.9654,
        "value": "185000",
        "bboxes": [
          {
            "bbox": [150, 290, 300, 320]
          }
        ],
        "page_no": 1
      }
    },
    "min_confidence_score": 0.9654
  },
  "processing_time": 15.7,
  "detections": [
    {
      "class": "Title",
      "confidence": 0.95,
      "bbox": [72, 100, 400, 140],
      "page": 1
    },
    {
      "class": "Text",
      "confidence": 0.89,
      "bbox": [72, 150, 500, 200],
      "page": 1
    }
  ],
  "citations": [
    {
      "field": "company_name",
      "text": "Acme Corporation",
      "page": 1,
      "bbox": [72, 100, 400, 140]
    }
  ]
}

Complete Workflow Example

Here’s a complete example of submitting a job, monitoring its progress, and retrieving results:

import requests
import time
import json

def process_document_with_results(file_path, schema, api_key):
    """Complete workflow: submit job, wait for completion, get results"""
    
    headers = {"X-API-Key": api_key}
    
    # Step 1: Submit extraction job
    files = {"pdf_file": open(file_path, "rb")}
    data = {"schema_data": json.dumps(schema)}
    
    response = requests.post(
        "https://visionapi.unsiloed.ai/cite",
        files=files,
        data=data,
        headers=headers
    )
    
    if response.status_code != 200:
        raise Exception(f"Failed to submit job: {response.text}")
    
    job_id = response.json()["job_id"]
    print(f"Job submitted: {job_id}")
    
    # Step 2: Poll for completion
    while True:
        status_response = requests.get(
            f"https://visionapi.unsiloed.ai/jobs/{job_id}",
            headers=headers
        )
        
        if status_response.status_code != 200:
            raise Exception(f"Failed to check status: {status_response.text}")
            
        job = status_response.json()
        status = job["status"]
        print(f"Job status: {status}")
        
        if status == "COMPLETED":
            break
        elif status == "FAILED":
            raise Exception(f"Job failed: {job.get('error', 'Unknown error')}")
        
        time.sleep(5)  # Wait 5 seconds before checking again
    
    # Step 3: Get results
    results_response = requests.get(
        f"https://visionapi.unsiloed.ai/jobs/{job_id}/result",
        headers=headers
    )
    
    if results_response.status_code != 200:
        raise Exception(f"Failed to get results: {results_response.text}")
    
    return results_response.json()

# Usage example
schema = {
    "type": "object",
    "properties": {
        "company_name": {
            "type": "string",
            "description": "Name of the company"
        },
        "total_amount": {
            "type": "number",
            "description": "Total financial amount"
        }
    },
    "required": ["company_name"],
    "additionalProperties": False
}

try:
    results = process_document_with_results("invoice.pdf", schema, "your-api-key")
    print("Extraction completed!")
    print("Results:", results["data"])
except Exception as e:
    print(f"Error: {e}")

Result Data Structure

Bounding Box Format

Bounding boxes use the format [x1, y1, x2, y2] where:

  • x1, y1: Top-left corner coordinates
  • x2, y2: Bottom-right corner coordinates
  • Coordinates are in pixels from the top-left of the page
  • Page numbers are 1-indexed

Confidence Scores

  • 0.9-1.0: Very high confidence, extraction is very likely correct
  • 0.8-0.9: High confidence, extraction is likely correct
  • 0.7-0.8: Good confidence, may warrant review for critical applications
  • 0.6-0.7: Medium confidence, should be reviewed
  • Below 0.6: Low confidence, likely needs manual verification

Error Handling

Best Practices

Check Status First: Always verify job status is “COMPLETED” before requesting results to avoid unnecessary API calls.

Handle Errors Gracefully: Implement proper error handling for different HTTP status codes and error scenarios.

Cache Results: Store important results locally, as they may be cleaned up after 7 days.

Result Persistence: Job results are automatically cleaned up after 7 days to manage storage costs.