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

# Get Sourcing Preview Results

> Returns the current state of a candidate sourcing preview run. Responds with 202 and status 'processing' while in progress, or 200 with the full candidate list (or error details) when completed.

Returns the current state of a sourcing preview run. While the run is in progress the response is `202 Accepted` with `status: "processing"`. Once finished it becomes `200 OK` with the candidate preview list (or error details if the run failed).

## Overview

Use this endpoint to poll for preview results when you do not have a webhook configured. The `requestId` is the value returned by [POST /sourcing/preview](/api-reference/sourcing/initiate-sourcing-preview).

## Polling Strategy

<Warning>
  Poll at most once every 10 seconds. Exceeding 120 requests per minute on this
  endpoint will trigger `429 RATE_LIMIT_EXCEEDED`.
</Warning>

```javascript theme={null}
async function waitForPreviewResults(requestId) {
  const url = `https://api.instaview.sk/sourcing/preview/${requestId}/results`;
  const headers = { Authorization: `Bearer ${process.env.INSTAVIEW_API_KEY}` };

  while (true) {
    const res = await fetch(url, { headers });
    if (res.status === 429) {
      const retryAfter = Number(res.headers.get("Retry-After") ?? 10);
      await new Promise((r) => setTimeout(r, retryAfter * 1000));
      continue;
    }
    if (!res.ok)
      throw new Error(`Preview polling failed with status ${res.status}`);
    const body = await res.json();

    if (body.status === "completed") return body.candidates;
    if (body.status === "failed")
      throw new Error(`Preview failed: ${body.errorMessage}`);

    await new Promise((r) => setTimeout(r, 10000));
  }
}
```

## Response Examples

### Still Processing (202 Accepted)

```json theme={null}
{
  "success": true,
  "requestId": "req_prev_9f3b827e-8c31-4bda-a7a2-b2d99d14f4e2",
  "status": "processing",
  "candidatesSourcedCount": 12,
  "message": "The sourcing agent is actively analyzing candidates. Please poll again in 10 seconds.",
  "createdAt": "2026-06-11T19:50:45.000Z"
}
```

### Completed (200 OK)

```json theme={null}
{
  "success": true,
  "requestId": "req_prev_9f3b827e-8c31-4bda-a7a2-b2d99d14f4e2",
  "status": "completed",
  "foundCount": 20,
  "scoredCount": 20,
  "createdAt": "2026-06-11T19:50:45.000Z",
  "completedAt": "2026-06-11T19:51:02.000Z",
  "candidates": [
    {
      "profileId": "prof_a9238f82-a723",
      "fullName": "Jane Doe",
      "profileUrl": "https://www.linkedin.com/in/janedoe-ml",
      "title": "Staff ML Infrastructure Engineer",
      "headline": "Staff ML Infrastructure Engineer at TechCorp",
      "location": "Seattle, WA, USA",
      "country": "United States",
      "companyName": "TechCorp",
      "companyUrl": "https://www.linkedin.com/company/techcorp"
    }
  ]
}
```

### Failed (200 OK with `status: "failed"`)

```json theme={null}
{
  "success": true,
  "requestId": "req_prev_9f3b827e-8c31-4bda-a7a2-b2d99d14f4e2",
  "status": "failed",
  "errorCode": "PROVIDER_TEMPORARILY_UNAVAILABLE",
  "errorMessage": "External sourcing indexing platform returned a 503 after exhausting retries.",
  "createdAt": "2026-06-11T19:50:45.000Z",
  "completedAt": "2026-06-11T19:51:01.000Z"
}
```

## Multi-Tenant Isolation

If the `requestId` does not belong to the company associated with the authenticating API key, or if the request ID format does not match a preview run, the API returns `404 REQUEST_NOT_FOUND` or `400 BAD_REQUEST`.


## OpenAPI

````yaml GET /sourcing/preview/{id}/results
openapi: 3.0.0
info:
  title: InstaView API
  description: |-
    InstaView API Documentation

    ## Authentication

    All endpoints require API key authentication using Bearer token:
    ```
    Authorization: Bearer sk_your_api_key_here
    ```

    ## API Key Management

    The API Key module provides comprehensive key management for:
    - **Direct Client Keys**: Company-scoped keys for your applications
    - **ATS Partner Keys**: Resource-scoped keys for ATS integrations

    ### Key Features
    - HMAC-SHA256 hashing for API key storage
    - Configurable rate limiting
    - Comprehensive audit logging
    - Company-level isolation
    - Resource scoping for ATS partners
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.instaview.sk
    description: Production API Gateway
security: []
tags: []
paths:
  /sourcing/preview/{id}/results:
    get:
      tags:
        - Public Sourcing
      summary: Get sourcing preview results
      description: >-
        Returns the current state of a candidate sourcing preview run. Responds
        with 202 and status 'processing' while in progress, or 200 with the full
        candidate list (or error details) when completed.
      operationId: PublicSourcingController_getSourcingPreviewResults_v1
      parameters:
        - name: id
          required: true
          in: path
          description: >-
            The requestId returned by POST /sourcing/preview (e.g.
            req_prev_550e8400-…).
          schema:
            type: string
            pattern: >-
              ^req_prev_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
      responses:
        '200':
          description: Sourcing preview results (completed or failed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicSourcingPreviewResultsResponseDto'
        '202':
          description: Sourcing preview run still in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicSourcingPreviewResultsResponseDto'
        '400':
          description: Bad Request - Invalid request ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Not Found - Sourcing preview request not found or belongs to another
            company
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests - Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    PublicSourcingPreviewResultsResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the response was successful.
          example: true
        requestId:
          type: string
          description: Unique external identifier for this sourcing run.
          example: req_prev_550e8400-e29b-41d4-a716-446655440000
        status:
          type: string
          description: Current status of the run.
          enum:
            - processing
            - completed
            - failed
          example: completed
        candidatesSourcedCount:
          type: integer
          description: >-
            Running count of candidates found so far. Present when status =
            'processing'.
          example: 8
        foundCount:
          type: integer
          description: Total number of candidates found before scoring.
          example: 42
        scoredCount:
          type: integer
          description: Number of candidates that were AI-scored.
          example: 30
        message:
          type: string
          description: Human-readable status message. Present when status = 'processing'.
          example: >-
            The sourcing agent is actively analyzing candidates. Please poll
            again in 10 seconds.
        candidates:
          type: array
          description: Scored and ranked candidates. Present when status = 'completed'.
          items:
            $ref: '#/components/schemas/PublicSourcingPreviewCandidateDto'
        errorCode:
          type: string
          description: Machine-readable error code when status = 'failed'.
          example: AGENT_ERROR
        errorMessage:
          type: string
          description: Human-readable error message when status = 'failed'.
          example: The sourcing agent encountered an unexpected error.
        createdAt:
          type: string
          description: ISO 8601 timestamp when the run was created.
          example: '2025-01-01T00:00:00.000Z'
        completedAt:
          type: string
          description: ISO 8601 timestamp when the run completed or failed.
          example: '2025-01-01T00:01:30.000Z'
      required:
        - success
        - requestId
        - status
        - createdAt
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          type: string
          example: Validation failed
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    PublicSourcingPreviewCandidateDto:
      type: object
      properties:
        profileId:
          type: string
          description: Opaque profile identifier (MD5 of LinkedIn URL).
          example: a1b2c3d4e5f6
        fullName:
          type: string
          description: Full name of the candidate.
          example: Jane Smith
        profileUrl:
          type: string
          description: LinkedIn profile URL.
          example: https://www.linkedin.com/in/janesmith
        title:
          type: string
          description: Candidate's current role/title.
          example: Senior Software Engineer
        headline:
          type: string
          description: Job headline or current title.
          example: Senior Software Engineer at Stripe
        location:
          type: string
          description: Candidate's location.
          example: San Francisco, CA
        country:
          type: string
          description: Candidate's country.
          example: United States
        companyName:
          type: string
          description: Candidate's current company.
          example: Stripe
        companyUrl:
          type: string
          description: Candidate's current company URL.
          example: https://www.linkedin.com/company/stripe
      required:
        - profileId
        - fullName
        - profileUrl
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key for authentication using Bearer scheme

````