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

# Upload to Knowledge Base

Upload competitive intelligence documents, assets, and battlecards to your library.

<Accordion title="Copy for AI context">
  ```text theme={null}
  POST https://app.usehindsight.com/api/v1/documents/library
  Authorization: Bearer YOUR_API_KEY
  Content-Type: multipart/form-data

  Request fields (multipart/form-data):
    file_name: string (required)
    file_url: string (uri) — URL to fetch file from
    file: binary — binary file content (alternative to file_url)
    content_type: string (required) — MIME type, e.g. application/pdf
    type: asset | intel (required)
    competitor_id: string — Hindsight competitor ID
    competitor_name: string — resolved to competitor_id automatically
    source: drive | notion | confluence | onedrive | sharepoint | vanta | url | zapier | api

  200 Response:
  {
    "document": {
      "id": "doc_abc123",
      "file_name": "Competitor X Pricing Guide.pdf",
      "status": "processing | ready | failed",
      "type": "asset | intel",
      "url": "https://app.usehindsight.com/deals/deal_123/documents/viewer/doc_abc123",
      "created_at": "2026-02-10T12:00:00Z"
    },
    "run_id": "run_xyz789"
  }

  Rate limits: 10 req/min (Essentials), 60 req/min (Growth), 300 req/min (Enterprise)
             10,000/mo (Essentials), 30,000/mo (Growth), 100,000/mo (Enterprise)
  ```
</Accordion>

## Document Types

| Type    | Description                                                   |
| ------- | ------------------------------------------------------------- |
| `asset` | Sales enablement content like battlecards, one-pagers, guides |
| `intel` | Competitive intelligence gathered from external sources       |

## Source Options

The `source` field determines the icon displayed in the Hindsight UI:

| Source       | Description       |
| ------------ | ----------------- |
| `drive`      | Google Drive      |
| `notion`     | Notion            |
| `confluence` | Confluence        |
| `onedrive`   | OneDrive          |
| `sharepoint` | SharePoint        |
| `vanta`      | Vanta             |
| `url`        | Web URL           |
| `zapier`     | Zapier automation |
| `api`        | API upload        |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://app.usehindsight.com/api/v1/documents/library \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file_name=Competitor X Pricing Guide.pdf" \
    -F "file_url=https://example.com/document.pdf" \
    -F "content_type=application/pdf" \
    -F "type=asset" \
    -F "competitor_name=Competitor X" \
    -F "source=drive"
  ```

  ```javascript Node.js theme={null}
  const formData = new FormData();
  formData.append('file_name', 'Competitor X Pricing Guide.pdf');
  formData.append('file_url', 'https://example.com/document.pdf');
  formData.append('content_type', 'application/pdf');
  formData.append('type', 'asset');
  formData.append('competitor_name', 'Competitor X');
  formData.append('source', 'drive');

  const response = await fetch('https://app.usehindsight.com/api/v1/documents/library', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    },
    body: formData
  });

  const data = await response.json();
  console.log(`Document uploaded: ${data.document.id}`);
  ```

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

  response = requests.post(
      'https://app.usehindsight.com/api/v1/documents/library',
      headers={'Authorization': f'Bearer {API_KEY}'},
      data={
          'file_name': 'Competitor X Pricing Guide.pdf',
          'file_url': 'https://example.com/document.pdf',
          'content_type': 'application/pdf',
          'type': 'asset',
          'competitor_name': 'Competitor X',
          'source': 'drive'
      }
  )

  data = response.json()
  print(f"Document uploaded: {data['document']['id']}")
  ```
</RequestExample>
