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

# Get a knowledge base source

> Get a single file or website source, including its processing status.

Poll this endpoint after adding, updating or syncing a source to track
its `status`. `failedDocuments` lists each document that failed and the
reason, and the latest sync run's `errorCode` explains why a crawl
failed. Crawled pages that failed before processing began are counted
in `documentCounts.failed` but not listed in `failedDocuments`.

`status` is only returned by this endpoint, not by the list endpoint.



## OpenAPI

````yaml GET /v1/agents/{agentId}/knowledge-base/sources/{sourceId}
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.11
  description: Manage PolyAI agents, telephony, deployments, and real-time configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.eu.poly.ai
    description: EU region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.studio.poly.ai
    description: Studio region
security:
  - polyApiKey: []
paths:
  /v1/agents/{agentId}/knowledge-base/sources/{sourceId}:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: sourceId
        in: path
        required: true
        schema:
          type: string
    get:
      tags:
        - Source Hub
      summary: Get a knowledge base source
      description: |-
        Get a single file or website source, including its processing status.

        Poll this endpoint after adding, updating or syncing a source to track
        its `status`. `failedDocuments` lists each document that failed and the
        reason, and the latest sync run's `errorCode` explains why a crawl
        failed. Crawled pages that failed before processing began are counted
        in `documentCounts.failed` but not listed in `failedDocuments`.

        `status` is only returned by this endpoint, not by the list endpoint.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSourceResponse'
        '401':
          description: Unauthorized – missing or invalid API key
        '403':
          description: Forbidden – insufficient permissions
        '404':
          description: Resource not found
components:
  schemas:
    GetSourceResponse:
      description: |-
        A knowledge base source, with a single status derived from the
        processing state of its documents.
      type: object
      properties:
        targetEnvSandbox:
          description: Whether the source is used in sandbox
          type:
            - boolean
            - 'null'
        targetEnvPrerelease:
          description: Whether the source is used in pre-release
          type:
            - boolean
            - 'null'
        targetEnvLive:
          description: Whether the source is used in live
          type:
            - boolean
            - 'null'
        variantIds:
          description: >-
            Variants the source applies to. An empty list or null applies it to
            all variants
          type:
            - array
            - 'null'
          items:
            type: string
        id:
          description: Unique source identifier
          type: string
        accountId:
          description: Account this source belongs to
          type: string
        projectId:
          description: Agent (project) this source belongs to
          type:
            - string
            - 'null'
        name:
          description: Display name of the source
          type: string
        createdAt:
          description: When the source was created
          type: string
        updatedAt:
          description: When the source was last updated
          type:
            - string
            - 'null'
        createdBy:
          description: Email of the user who created the source
          type: string
        updatedBy:
          description: Email of the user who last updated the source
          type:
            - string
            - 'null'
        sourceType:
          description: Source type (file, website)
          type: string
        sourceUrl:
          description: URL a website source is crawled from
          type:
            - string
            - 'null'
        syncInterval:
          description: Seconds between scheduled syncs; null when not scheduled
          type:
            - integer
            - 'null'
        webScrapeConfig:
          description: How a website source is crawled
          anyOf:
            - $ref: '#/components/schemas/WebScrapeConfigResponse'
            - type: 'null'
        documentCount:
          description: Number of live documents ingested from the source
          type: integer
        latestSyncRun:
          description: The source's most recent sync run
          anyOf:
            - $ref: '#/components/schemas/SourceSyncRunResponse'
            - type: 'null'
        status:
          description: >-
            pending: no documents yet and no sync has started. in_progress: a
            sync is running or documents are still being processed. completed:
            all documents are searchable. completed_with_errors: some documents
            are searchable, but others failed or the website's latest crawl
            failed. failed: all documents failed, or the sync failed and nothing
            is searchable.
          allOf:
            - $ref: '#/components/schemas/SourceStatus'
        documentCounts:
          description: How many documents are in each stage
          allOf:
            - $ref: '#/components/schemas/DocumentCountsResponse'
        failedDocuments:
          description: Documents that failed processing, and why
          type: array
          items:
            $ref: '#/components/schemas/FailedDocumentResponse'
      required:
        - id
        - accountId
        - name
        - createdAt
        - createdBy
        - sourceType
        - documentCount
        - status
        - documentCounts
        - failedDocuments
    WebScrapeConfigResponse:
      description: >-
        Crawl settings for a website source. Unset settings use the crawler
        defaults.
      type: object
      properties:
        pageLimit:
          description: Maximum number of pages the crawl visits
          type:
            - integer
            - 'null'
    SourceSyncRunResponse:
      description: A source's most recent sync run.
      type: object
      properties:
        syncRunId:
          description: Unique sync run identifier
          type: string
        status:
          description: Run status (started, succeeded, failed)
          type: string
        startedAt:
          description: When the run started
          type: string
        finishedAt:
          description: When the run finished; null while it is running
          type:
            - string
            - 'null'
        errorCode:
          description: Reason the run failed, if it failed
          type:
            - string
            - 'null'
      required:
        - syncRunId
        - status
        - startedAt
    SourceStatus:
      description: Processing status of a source.
      enum:
        - pending
        - in_progress
        - completed
        - completed_with_errors
        - failed
      type: string
    DocumentCountsResponse:
      description: |-
        Number of the source's documents in each processing stage. Documents
        being deleted are not counted.
      type: object
      properties:
        pending:
          description: Documents still being processed and not yet searchable
          type: integer
        completed:
          description: Documents the agent can search
          type: integer
        failed:
          description: >-
            Documents that failed processing. Can be higher than the number of
            entries in failedDocuments, because crawled pages that failed before
            processing began are counted but not listed
          type: integer
      required:
        - pending
        - completed
        - failed
    FailedDocumentResponse:
      description: A document from the source that failed processing.
      type: object
      properties:
        id:
          description: Unique document identifier
          type: string
        fileName:
          description: File name, or the page URL for a website source
          type:
            - string
            - 'null'
        error:
          description: Failure details, if a reason was recorded
          anyOf:
            - $ref: '#/components/schemas/DocumentErrorResponse'
            - type: 'null'
      required:
        - id
    DocumentErrorResponse:
      description: Details of a document processing failure.
      type: object
      properties:
        step:
          description: >-
            Processing step that failed (ingestion, extraction, chunking,
            chunk_metadata, embedding, index_upsert)
          type: string
        errorCode:
          description: Reason the step failed
          type: string
        occurredAt:
          description: When the step failed
          type: string
      required:
        - step
        - errorCode
        - occurredAt
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````