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

# Get Job Results

> Get the final results and extracted documents from a completed job

Returns the final results of a completed scraping job, including all extracted documents.

## Path Parameters

| Parameter | Type   | Description           |
| --------- | ------ | --------------------- |
| `job_id`  | string | Unique job identifier |

## Example Request

```javascript theme={null}
const getResults = async (jobId) => {
  const response = await fetch(`https://api.skop.dev/scrape/results/${jobId}`, {
    headers: {
      'Authorization': 'Bearer sk-your-api-key'
    }
  })
  
  return await response.json()
}
```

## Response (200 OK)

```json theme={null}
{
  "job_id": "job_123456789",
  "status": "completed",
  "message": "Job completed successfully. Found 12 document(s).",
  "documents": [
    {
      "name": "Board Meeting Minutes - January 2024",
      "url": "https://example.com/docs/minutes-jan-2024.pdf",
      "source_page": "https://example.com/meetings",
      "document_type": "pdf",
      "confidence_score": 0.95,
      "file_size_mb": 2.3,
      "extracted_at": "2024-01-15T10:25:00Z"
    }
  ],
  "metadata": {
    "job_id": "job_123456789",
    "created_at": "2024-01-15T10:00:00Z",
    "started_at": "2024-01-15T10:01:00Z",
    "completed_at": "2024-01-15T10:28:00Z",
    "estimated_completion": "2024-01-15T10:30:00Z",
    "original_website": "https://example.com",
    "original_prompt": "Find all board meeting minutes from 2024",
    "parameters": {
      "single_page": false,
      "timeout": 1800,
      "confidence_threshold": 0.7
    },
    "current_agent": null,
    "agents_completed": ["coordinator", "navigator", "scraper"],
    "total_pages_crawled": 4,
    "total_documents_found": 15,
    "errors": [],
    "warnings": ["Some documents were too large to download"],
    "final_status": "completed"
  },
  "total_documents_found": 15,
  "total_documents_downloaded": 12,
  "total_pages_crawled": 4,
  "success_rate": 0.8,
  "cost": 2.16,
  "total_runtime_seconds": 1680,
  "runtime_minutes": 28.0,
  "errors": [],
  "warnings": ["Some documents were too large to download"],
  "has_errors": false
}
```

### Response Fields

| Field                        | Type    | Description                          |
| ---------------------------- | ------- | ------------------------------------ |
| `job_id`                     | string  | Job identifier                       |
| `status`                     | string  | Job status (should be `completed`)   |
| `message`                    | string  | Summary message with document count  |
| `documents`                  | array   | Array of extracted document objects  |
| `metadata`                   | object  | Job metadata and original parameters |
| `total_documents_found`      | number  | Total documents discovered           |
| `total_documents_downloaded` | number  | Successfully downloaded documents    |
| `total_pages_crawled`        | number  | Pages processed during scraping      |
| `success_rate`               | number  | Success rate (0.0-1.0)               |
| `cost`                       | number  | Total cost in USD for this job       |
| `total_runtime_seconds`      | number  | Job execution time in seconds        |
| `runtime_minutes`            | number  | Job execution time in minutes        |
| `has_errors`                 | boolean | Whether any errors occurred          |
| `errors`                     | array   | List of error objects (if any)       |
| `warnings`                   | array   | List of warning messages (if any)    |

### Document Object Fields

| Field              | Type   | Description                           |
| ------------------ | ------ | ------------------------------------- |
| `name`             | string | Human-readable document name          |
| `url`              | string | Direct URL to the document file       |
| `source_page`      | string | Web page where document was found     |
| `document_type`    | string | File type (pdf, doc, docx, txt, etc.) |
| `confidence_score` | number | AI confidence score (0.0-1.0)         |
| `file_size_mb`     | number | File size in megabytes                |
| `extracted_at`     | string | ISO 8601 extraction timestamp         |

## Error Responses

| Status | Description                    |
| ------ | ------------------------------ |
| `404`  | Job not found or access denied |
| `500`  | Internal server error          |

## Example Usage

```javascript theme={null}
const processJob = async (jobId) => {
  // Wait for job completion
  let status
  do {
    await new Promise(resolve => setTimeout(resolve, 5000))
    status = await fetch(`https://api.skop.dev/scrape/status/${jobId}`, {
      headers: { 'Authorization': 'Bearer sk-your-api-key' }
    }).then(r => r.json())
  } while (status.is_active)
  
  // Get results if completed successfully
  if (status.status === 'completed') {
    const results = await getResults(jobId)
    
    console.log(`Found ${results.documents.length} documents:`)
    results.documents.forEach(doc => {
      console.log(`- ${doc.name} (${doc.confidence_score.toFixed(2)} confidence)`)
    })
    
    return results
  } else {
    console.error('Job failed:', status.message)
    return null
  }
}
```


## OpenAPI

````yaml GET /scrape/results/{job_id}
openapi: 3.1.0
info:
  title: Skop PDF Scraper API
  description: >-
    AI-powered document discovery and extraction from websites using natural
    language prompts
  version: 1.0.0
  contact:
    email: support@skop.dev
  license:
    name: MIT
servers:
  - url: https://api.skop.dev
    description: Production server
security:
  - bearerAuth: []
paths:
  /scrape/results/{job_id}:
    get:
      summary: Get Job Results
      description: Get the final results and extracted documents from a completed job
      operationId: getJobResults
      parameters:
        - name: job_id
          in: path
          required: true
          description: Unique job identifier
          schema:
            type: string
            pattern: ^job_[a-z0-9]+$
      responses:
        '200':
          description: Job results with extracted documents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobResultsResponse'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    JobResultsResponse:
      type: object
      properties:
        job_id:
          type: string
          pattern: ^job_[a-z0-9]+$
          description: Job identifier
        status:
          $ref: '#/components/schemas/JobStatus'
        message:
          type: string
          description: Summary message with document count
        documents:
          type: array
          items:
            $ref: '#/components/schemas/ExtractedDocument'
          description: Array of extracted document objects
        metadata:
          $ref: '#/components/schemas/JobMetadata'
        total_documents_found:
          type: integer
          description: Total documents discovered
        total_documents_downloaded:
          type: integer
          description: Successfully downloaded documents
        total_pages_crawled:
          type: integer
          description: Pages processed during scraping
        success_rate:
          type: number
          minimum: 0
          maximum: 1
          description: Success rate (0.0-1.0)
        cost:
          type: number
          description: Total cost in USD for this job
        total_runtime_seconds:
          type: number
          description: Job execution time in seconds
        runtime_minutes:
          type: number
          description: Job execution time in minutes
        has_errors:
          type: boolean
          description: Whether any errors occurred
        errors:
          type: array
          items:
            $ref: '#/components/schemas/JobError'
          description: List of error objects (if any)
        warnings:
          type: array
          items:
            type: string
          description: List of warning messages (if any)
    ErrorResponse:
      type: object
      properties:
        error:
          type: boolean
          example: true
          description: Indicates this is an error response
        message:
          type: string
          description: Human-readable error message
        status_code:
          type: integer
          description: HTTP status code
        path:
          type: string
          description: API path that generated the error
        timestamp:
          type: string
          format: date-time
          description: ISO 8601 error timestamp
    JobStatus:
      type: string
      enum:
        - pending
        - in_progress
        - completed
        - failed
        - cancelled
      description: Current status of the job
    ExtractedDocument:
      type: object
      properties:
        name:
          type: string
          description: Human-readable document name
        url:
          type: string
          format: uri
          description: Direct URL to the document file
        source_page:
          type: string
          format: uri
          description: Web page where document was found
        document_type:
          type: string
          description: File type (pdf, doc, docx, txt, etc.)
        confidence_score:
          type: number
          minimum: 0
          maximum: 1
          description: AI confidence score for relevance (0.0-1.0)
        file_size_mb:
          type: number
          description: File size in megabytes
        extracted_at:
          type: string
          format: date-time
          description: ISO 8601 extraction timestamp
    JobMetadata:
      type: object
      properties:
        job_id:
          type: string
          pattern: ^job_[a-z0-9]+$
          description: Job identifier
        created_at:
          type: string
          format: date-time
          description: ISO 8601 job creation timestamp
        completed_at:
          type: string
          format: date-time
          description: ISO 8601 job completion timestamp
        original_website:
          type: string
          format: uri
          description: Original website URL provided
        original_prompt:
          type: string
          description: Original prompt provided
        parameters:
          $ref: '#/components/schemas/ScrapeParameters'
    JobError:
      type: object
      properties:
        error_id:
          type: string
          description: Unique error identifier
        agent_name:
          type: string
          description: Name of the agent that encountered the error
        error_type:
          type: string
          description: Category of error
        error_message:
          type: string
          description: Human-readable error description
        page_url:
          type: string
          format: uri
          nullable: true
          description: URL where error occurred (if applicable)
        timestamp:
          type: string
          format: date-time
          description: ISO 8601 error timestamp
        is_recoverable:
          type: boolean
          description: Whether the error could potentially be recovered from
    ScrapeParameters:
      type: object
      properties:
        single_page:
          type: boolean
          default: false
          description: Only scrape the provided URL, don't navigate to other pages
        timeout:
          type: integer
          minimum: 60
          maximum: 3600
          default: 1800
          description: Job timeout in seconds (60-3600)
        confidence_threshold:
          type: number
          minimum: 0
          maximum: 1
          default: 0.1
          description: Minimum AI confidence score for document relevance (0.0-1.0)
        file_type:
          type: string
          enum:
            - document
          default: document
          description: Type of files to extract
        max_file_size_mb:
          type: integer
          minimum: 1
          maximum: 500
          default: 100
          description: Maximum file size to download in MB (1-500)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key in format 'sk-xxxxxxxxxxxxx' or 'sk_xxxxxxxxxxxxx'

````