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

# Knowledge Base Sources

> List sources or add URL/file sources to a knowledge base

## Path Parameters

<ParamField path="knowledgeBaseId" type="string" required>
  Knowledge base ID (UUID).
</ParamField>

## List Sources

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.telzino.com/v1/knowledge-bases/11111111-1111-1111-1111-111111111111/sources \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "22222222-2222-2222-2222-222222222222",
        "knowledge_base_id": "11111111-1111-1111-1111-111111111111",
        "organization_id": "987fcdeb-51a2-3bc4-d567-890123456789",
        "name": "https://example.com/docs",
        "source_type": "url",
        "status": "active",
        "url": "https://example.com/docs",
        "chunk_count": 12,
        "last_synced_at": "2026-06-17T12:30:00Z",
        "created_at": "2026-06-17T12:00:00Z"
      }
    ]
  }
  ```
</ResponseExample>

## Add a URL Source

<ParamField body="sourceType" type="string" required>
  Must be `url`.
</ParamField>

<ParamField body="url" type="string" required>
  URL to crawl and ingest.
</ParamField>

<ParamField body="forceReingest" type="boolean">
  If the URL already exists, re-ingest the existing source instead of returning a duplicate error.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.telzino.com/v1/knowledge-bases/11111111-1111-1111-1111-111111111111/sources \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "sourceType": "url",
      "url": "https://example.com/docs"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "data": {
      "sourceId": "22222222-2222-2222-2222-222222222222",
      "jobId": "33333333-3333-3333-3333-333333333333"
    }
  }
  ```
</ResponseExample>

## Add a File Source

File ingestion uses a two-step upload, then an enqueue call:

1. Create a file source to get `presignedUrl`, `sourceId`, and `jobId`.
2. Upload the file bytes to `presignedUrl` with `PUT`.
3. Call [Enqueue File Source](/api-reference/knowledge-bases/source-actions#enqueue-file-ingestion).

<ParamField body="sourceType" type="string" required>
  Must be `file`.
</ParamField>

<ParamField body="fileName" type="string" required>
  Original file name.
</ParamField>

<ParamField body="fileMime" type="string" required>
  MIME type. Supported: `application/pdf`, DOCX, TXT, HTML, CSV, and Markdown MIME types.
</ParamField>

<ParamField body="fileSize" type="number" required>
  File size in bytes. Maximum 50 MB.
</ParamField>

<ParamField body="contentHash" type="string">
  Optional client-computed hash used for duplicate detection.
</ParamField>

<ParamField body="forceReingest" type="boolean">
  Skip duplicate blocking for the submitted file hash.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.telzino.com/v1/knowledge-bases/11111111-1111-1111-1111-111111111111/sources \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "sourceType": "file",
      "fileName": "guide.pdf",
      "fileMime": "application/pdf",
      "fileSize": 1048576,
      "contentHash": "9a0364b9e99bb480dd25e1f0284c8555"
    }'
  ```

  ```bash Upload file bytes theme={null}
  curl -X PUT "PRESIGNED_URL_FROM_RESPONSE" \
    -H "Content-Type: application/pdf" \
    --data-binary "@guide.pdf"
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "data": {
      "presignedUrl": "https://s3.amazonaws.com/...",
      "fileKey": "rag/org/kb/source/original.pdf",
      "sourceId": "22222222-2222-2222-2222-222222222222",
      "jobId": "33333333-3333-3333-3333-333333333333"
    }
  }
  ```

  ```json 409 theme={null}
  {
    "error": "duplicate_source",
    "error_description": "This file already exists in the knowledge base",
    "details": {
      "existingSource": {
        "id": "22222222-2222-2222-2222-222222222222",
        "name": "guide.pdf",
        "status": "active"
      }
    }
  }
  ```
</ResponseExample>
