> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unsiloed.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Split Result

> Check the status and retrieve results of document splitting jobs

## Overview

The Get Split Status endpoint retrieves the status and results of a document splitting job. Use this endpoint to check if splitting is complete and download the resulting split documents.

<Note>
  Splitting jobs are processed asynchronously. Poll this endpoint to check completion status.
</Note>

## Path Parameters

<ParamField path="job_id" type="string" required>
  The unique identifier of the splitting job
</ParamField>

## Response

<ResponseField name="job_id" type="string">
  Unique identifier for the splitting job
</ResponseField>

<ResponseField name="status" type="string">
  Current job status: "queued" while the job waits to be picked up, "processing" while it runs, then "completed" or "failed"
</ResponseField>

<ResponseField name="progress" type="string">
  Progress message describing current processing stage
</ResponseField>

<ResponseField name="file_url" type="string">
  Presigned download URL for the original uploaded file. Expires roughly an hour after the response is generated; re-issue this request to get a fresh URL.
</ResponseField>

<ResponseField name="file_name" type="string">
  Name of the original file
</ResponseField>

<ResponseField name="parameters" type="object">
  Echo of the parameters used for this job

  <Expandable title="parameters_structure">
    <ResponseField name="classes" type="array">
      The category names submitted with the job
    </ResponseField>

    <ResponseField name="category_descriptions" type="object">
      The descriptions submitted for each category, when provided
    </ResponseField>

    <ResponseField name="enable_reordering" type="boolean">
      Whether pages were reordered within each category after classification
    </ResponseField>

    <ResponseField name="page_count" type="number">
      Number of pages in the uploaded document
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="result" type="object">
  Split results. Always present as a key; `null` until status is "completed"

  <Expandable title="result_structure">
    <ResponseField name="success" type="boolean">
      Whether the splitting operation succeeded
    </ResponseField>

    <ResponseField name="message" type="string">
      Success/failure message (e.g., "Successfully split PDF into 3 files")
    </ResponseField>

    <ResponseField name="files" type="array">
      Array of split PDF files

      <Expandable title="file_structure">
        <ResponseField name="name" type="string">
          Name of the split file (e.g., "Invoice.pdf")
        </ResponseField>

        <ResponseField name="path" type="string">
          Relative path to the file
        </ResponseField>

        <ResponseField name="type" type="string">
          File type (always "file")
        </ResponseField>

        <ResponseField name="fileId" type="string">
          Unique file identifier
        </ResponseField>

        <ResponseField name="full_path" type="string">
          Presigned download URL for the split file. Expires roughly an hour after the response is generated, so download the file straight away rather than storing the URL. Re-issue this request to get a fresh URL.
        </ResponseField>

        <ResponseField name="confidence_score" type="number">
          Classification confidence score (0.0-1.0)
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="error" type="string">
  Error message (if job failed, otherwise null)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://prod.visionapi.unsiloed.ai/splitter/04a7a6d8-5ef7-465a-b22a-8a98e7104dd9" \
    -H "accept: application/json" \
    -H "api-key: your-api-key"
  ```

  ```python Python theme={null}
  import requests

  def get_split_status(job_id, api_key):
      """Get the status of a splitting job"""

      url = f"https://prod.visionapi.unsiloed.ai/splitter/{job_id}"
      headers = {"api-key": api_key}

      response = requests.get(url, headers=headers)

      if response.status_code == 200:
          job = response.json()
          print(f"Job Status: {job['status']}")

          if job['status'] == 'completed':
              print("Split completed successfully!")
              if job.get('result', {}).get('success'):
                  print(f"Message: {job['result']['message']}")
                  for file_info in job['result']['files']:
                      print(f"  File: {file_info['name']}")
                      print(f"    Download: {file_info['full_path']}")
              return job
          elif job['status'] == 'failed':
              print(f"Job failed: {job.get('error', 'Unknown error')}")
              return None
          elif job['status'] == 'processing':
              print(f"Job is processing: {job.get('progress', '')}")
              return job
      else:
          print("Error:", response.status_code, response.text)
          return None

  # Usage
  job_id = "04a7a6d8-5ef7-465a-b22a-8a98e7104dd9"
  result = get_split_status(job_id, "your-api-key")
  ```

  ```javascript JavaScript theme={null}
  async function getSplitStatus(jobId, apiKey) {
    const response = await fetch(`https://prod.visionapi.unsiloed.ai/splitter/${jobId}`, {
      headers: {
        'accept': 'application/json',
        'api-key': apiKey
      }
    });

    if (response.ok) {
      const job = await response.json();
      console.log('Job Status:', job.status);

      switch (job.status) {
        case 'completed':
          console.log('Split completed successfully!');
          if (job.result?.success) {
            console.log('Message:', job.result.message);
            job.result.files.forEach(file => {
              console.log(`  File: ${file.name}`);
              console.log(`    Download: ${file.full_path}`);
            });
          }
          return job;
        case 'failed':
          console.log('Job failed:', job.error || 'Unknown error');
          return null;
        case 'processing':
          console.log('Job is processing:', job.progress || '');
          return job;
        default:
          console.log('Unknown status:', job.status);
          return job;
      }
    } else {
      console.error('Failed to get job status:', await response.text());
      return null;
    }
  }

  // Usage
  const jobId = '04a7a6d8-5ef7-465a-b22a-8a98e7104dd9';
  const result = await getSplitStatus(jobId, 'your-api-key');
  ```
</RequestExample>

## Polling for Job Completion

Here are complete examples that poll the splitting job until it completes:

<RequestExample>
  ```bash cURL (with polling) theme={null}
  #!/bin/bash

  JOB_ID="04a7a6d8-5ef7-465a-b22a-8a98e7104dd9"
  API_KEY="your-api-key"
  MAX_ATTEMPTS=60
  SLEEP_INTERVAL=5

  echo "Polling split job status..."

  for ((i=1; i<=MAX_ATTEMPTS; i++)); do
    echo "Attempt $i..."
    
    RESPONSE=$(curl -s -X GET "https://prod.visionapi.unsiloed.ai/splitter/$JOB_ID" \
      -H "accept: application/json" \
      -H "api-key: $API_KEY")
    
    STATUS=$(echo $RESPONSE | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
    
    echo "Status: $STATUS"
    
    if [ "$STATUS" = "completed" ]; then
      echo "Split completed successfully!"
      echo $RESPONSE | python -m json.tool
      break
    elif [ "$STATUS" = "failed" ]; then
      echo "Split failed!"
      echo $RESPONSE | python -m json.tool
      break
    else
      echo "Still processing... waiting $SLEEP_INTERVAL seconds"
      sleep $SLEEP_INTERVAL
    fi
  done
  ```

  ```python Python (with polling) theme={null}
  import requests
  import time

  def poll_split_job(job_id, api_key, max_attempts=60, sleep_interval=5):
      """
      Poll a splitting job until completion or failure
      
      Args:
          job_id: The job ID returned from split request
          api_key: Your API key
          max_attempts: Maximum number of polling attempts
          sleep_interval: Seconds to wait between polls
      
      Returns:
          Final job result or None if failed
      """
      url = f"https://prod.visionapi.unsiloed.ai/splitter/{job_id}"
      headers = {"api-key": api_key}
      
      print(f"Polling split job {job_id}...")
      
      for attempt in range(1, max_attempts + 1):
          print(f"Attempt {attempt}...")
          
          try:
              response = requests.get(url, headers=headers)
              
              if response.status_code == 200:
                  job = response.json()
                  status = job.get('status')
                  progress = job.get('progress', '')
                  
                  print(f"Status: {status}")
                  if progress:
                      print(f"Progress: {progress}")
                  
                  if status == 'completed':
                      print("\n✓ Split completed successfully!")
                      if job.get('result', {}).get('success'):
                          print(f"Message: {job['result']['message']}")
                          print(f"\nSplit files:")
                          for file_info in job['result']['files']:
                              print(f"  • {file_info['name']}")
                              print(f"    Download: {file_info['full_path']}")
                              print(f"    Confidence: {file_info['confidence_score']:.2%}")
                      return job
                  
                  elif status == 'failed':
                      print(f"\n✗ Split failed: {job.get('error', 'Unknown error')}")
                      return None
                  
                  elif status == 'processing':
                      print(f"Still processing... waiting {sleep_interval} seconds\n")
                      time.sleep(sleep_interval)
                  
              elif response.status_code == 404:
                  print(f"Job not found. It may have expired.")
                  return None
              else:
                  print(f"Error: {response.status_code} - {response.text}")
                  return None
                  
          except Exception as e:
              print(f"Error polling job: {e}")
              return None
      
      print(f"Max attempts ({max_attempts}) reached. Job may still be processing.")
      return None

  # Usage
  job_id = "04a7a6d8-5ef7-465a-b22a-8a98e7104dd9"
  result = poll_split_job(job_id, "your-api-key")

  if result:
      print("Split job finished.")
  ```

  ```javascript JavaScript (with polling) theme={null}
  async function pollSplitJob(jobId, apiKey, maxAttempts = 60, sleepInterval = 5000) {
    /**
     * Poll a splitting job until completion or failure
     * 
     * @param {string} jobId - The job ID returned from split request
     * @param {string} apiKey - Your API key
     * @param {number} maxAttempts - Maximum number of polling attempts
     * @param {number} sleepInterval - Milliseconds to wait between polls
     * @returns {Promise<object|null>} Final job result or null if failed
     */
    
    const url = `https://prod.visionapi.unsiloed.ai/splitter/${jobId}`;
    
    console.log(`Polling split job ${jobId}...`);
    
    for (let attempt = 1; attempt <= maxAttempts; attempt++) {
      console.log(`Attempt ${attempt}...`);
      
      try {
        const response = await fetch(url, {
          headers: {
            'accept': 'application/json',
            'api-key': apiKey
          }
        });
        
        if (response.ok) {
          const job = await response.json();
          const { status, progress } = job;
          
          console.log(`Status: ${status}`);
          if (progress) console.log(`Progress: ${progress}`);
          
          if (status === 'completed') {
            console.log('\n✓ Split completed successfully!');
            if (job.result?.success) {
              console.log(`Message: ${job.result.message}`);
              console.log('\nSplit files:');
              job.result.files.forEach(file => {
                console.log(`  • ${file.name}`);
                console.log(`    Download: ${file.full_path}`);
                console.log(`    Confidence: ${(file.confidence_score * 100).toFixed(2)}%`);
              });
            }
            return job;
          }
          
          if (status === 'failed') {
            console.log(`\n✗ Split failed: ${job.error || 'Unknown error'}`);
            return null;
          }
          
          if (status === 'processing') {
            console.log(`Still processing... waiting ${sleepInterval/1000} seconds\n`);
            await new Promise(resolve => setTimeout(resolve, sleepInterval));
          }
          
        } else if (response.status === 404) {
          console.log('Job not found. It may have expired.');
          return null;
        } else {
          console.error('Error:', response.status, await response.text());
          return null;
        }
        
      } catch (error) {
        console.error('Error polling job:', error);
        return null;
      }
    }
    
    console.log(`Max attempts (${maxAttempts}) reached. Job may still be processing.`);
    return null;
  }

  // Usage
  const jobId = '04a7a6d8-5ef7-465a-b22a-8a98e7104dd9';
  const result = await pollSplitJob(jobId, 'your-api-key');

  if (result) {
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Completed Job theme={null}
  {
    "job_id": "c8a86841-beb1-4d00-ac4f-2f9fb9de9d5a",
    "status": "completed",
    "progress": "Starting document splitting...",
    "file_url": "https://example-bucket.s3.amazonaws.com/user_uploads/...?AWSAccessKeyId=...&Signature=...&Expires=...",
    "file_name": "mixed_documents.pdf",
    "parameters": {
      "classes": ["Invoice", "Receipt", "Contract"],
      "category_descriptions": {
        "Invoice": "Financial invoices with itemized charges",
        "Receipt": "Purchase receipts"
      },
      "enable_reordering": false,
      "page_count": 10
    },
    "result": {
      "success": true,
      "message": "Successfully split PDF into 3 files",
      "files": [
        {
          "name": "Invoice.pdf",
          "path": "Invoice.pdf",
          "type": "file",
          "fileId": "580e091d-c354-4558-8318-89e600346691",
          "full_path": "https://example-bucket.s3.amazonaws.com/files/...?AWSAccessKeyId=...&Signature=...&Expires=...",
          "confidence_score": 0.999147126422347
        },
        {
          "name": "Contract.pdf",
          "path": "Contract.pdf",
          "type": "file",
          "fileId": "680e091d-c354-4558-8318-89e600346692",
          "full_path": "https://example-bucket.s3.amazonaws.com/files/...?AWSAccessKeyId=...&Signature=...&Expires=...",
          "confidence_score": 0.987654321098765
        }
      ]
    },
    "error": null
  }
  ```

  ```json Processing Job theme={null}
  {
    "job_id": "c8a86841-beb1-4d00-ac4f-2f9fb9de9d5a",
    "status": "processing",
    "progress": "Starting document splitting...",
    "file_url": "https://example-bucket.s3.amazonaws.com/user_uploads/...?AWSAccessKeyId=...&Signature=...&Expires=...",
    "file_name": "mixed_documents.pdf",
    "parameters": {
      "classes": ["Invoice", "Receipt", "Contract"],
      "category_descriptions": {},
      "enable_reordering": false,
      "page_count": 10
    },
    "result": null,
    "error": null
  }
  ```

  ```json Failed Job theme={null}
  {
    "job_id": "c8a86841-beb1-4d00-ac4f-2f9fb9de9d5a",
    "status": "failed",
    "progress": "Starting document splitting...",
    "file_url": "https://example-bucket.s3.amazonaws.com/user_uploads/...?AWSAccessKeyId=...&Signature=...&Expires=...",
    "file_name": "mixed_documents.pdf",
    "parameters": {
      "classes": ["Invoice", "Receipt", "Contract"],
      "category_descriptions": {},
      "enable_reordering": false,
      "page_count": 10
    },
    "result": null,
    "error": "Failed to process document: Invalid PDF format"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml api-reference/openapi.json GET /splitter/{job_id}
openapi: 3.1.0
info:
  title: Unsiloed AI Document Processing API
  description: >-
    A comprehensive API for document processing, extraction, and analysis using
    AI-powered tools
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://prod.visionapi.unsiloed.ai
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /splitter/{job_id}:
    get:
      summary: Get Split Status
      description: Check the status and retrieve results of document splitting jobs
      parameters:
        - in: path
          name: job_id
          schema:
            type: string
          required: true
          description: The unique identifier of the splitting job
      responses:
        '200':
          description: Split job status and results retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    description: Unique identifier for the splitting job
                  status:
                    type: string
                    description: Current job status (queued, processing, completed, failed)
                  progress:
                    type: string
                    description: Progress message
                  file_url:
                    type: string
                    description: >-
                      Presigned download URL for the original uploaded file.
                      Expires roughly an hour after the response is generated;
                      re-issue this request for a fresh URL.
                  file_name:
                    type: string
                    description: Name of the original file
                  parameters:
                    type: object
                    description: Job parameters
                    properties:
                      classes:
                        type: array
                        description: List of category names
                        items:
                          type: string
                      category_descriptions:
                        type: object
                        description: Category descriptions map
                      enable_reordering:
                        type: boolean
                        description: >-
                          Whether pages were reordered within each category
                          after classification
                      page_count:
                        type: integer
                        description: Number of pages in the uploaded document
                  result:
                    type: object
                    description: Split results (only present when status is completed)
                    properties:
                      success:
                        type: boolean
                        description: Whether splitting succeeded
                      message:
                        type: string
                        description: Success/failure message
                      files:
                        type: array
                        description: Array of split PDF files
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              description: Name of the split file
                            path:
                              type: string
                              description: Relative path to the file
                            type:
                              type: string
                              description: File type (always 'file')
                            fileId:
                              type: string
                              description: Unique file identifier
                            full_path:
                              type: string
                              description: >-
                                Presigned download URL for the split file.
                                Expires roughly an hour after the response is
                                generated, so download the file straight away
                                rather than storing the URL. Re-issue this
                                request for a fresh URL.
                            confidence_score:
                              type: number
                              description: Classification confidence score (0-1)
                  error:
                    type: string
                    description: Error message if job failed
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: api-key

````