---
title: "Upload document to knowledge base"
method: POST
path: "/documents/library"
tags: ["Documents"]
---

# Upload document to knowledge base

`POST /documents/library`

## Request

- Base URL: `https://app.usehindsight.com/api/v1`
- URL: `https://app.usehindsight.com/api/v1/documents/library`
- Auth: HTTP bearer

Upload competitive intelligence documents, assets, and other files to your library.
Documents are automatically processed, chunked, and indexed for search.

## Request body `multipart/form-data`

- LibraryDocumentUploadRequest
  - `file_name` string, required: Name of the file
  - `file_url` string, uri: URL to download the file from (provide either file_url or file)
  - `file` string, binary: Binary file content (provide either file or file_url)
  - `content_type` 'application/pdf' | 'text/markdown' | 'text/plain' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', required: MIME type of the file
  - `type` 'asset' | 'intel', required: Document type
  - `competitor_id` string: Hindsight competitor ID (provide either competitor_id or competitor_name)
  - `competitor_name` string: Competitor name - will be resolved to competitor_id automatically
  - `source` 'drive' | 'notion' | 'confluence' | 'onedrive' | 'sharepoint' | 'vanta' | 'url' | 'zapier' | 'api': Source application where the document originated

## Response `200`

Document upload initiated

- DocumentUploadResponse
  - `document` object
    - `id` string: Unique identifier for the document
    - `file_name` string: Name of the uploaded file
    - `status` 'processing' | 'ready' | 'failed': Processing status of the document
    - `type` 'asset' | 'intel': Document type
    - `url` string, uri: URL to view the document in Hindsight
    - `created_at` string, date-time: Timestamp when the document was created
  - `run_id` string: ID to track the document processing run

## Other responses

- `400`: Bad request - invalid parameters
- `401`: Unauthorized - invalid or missing API key
- `429`: Too many requests - rate limit or applicable usage quota exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/usehindsight/apis/hindsight-api.md) - [All operations](https://skmtc.dev/usehindsight/apis/hindsight-api/llms.txt) - [OpenAPI document](https://skmtc.dev/usehindsight/apis/hindsight-api/revisions/97371a7da857?raw)
