Upload a file to a knowledge folder
Knowledge Folder API
Upload File to Knowledge Folder
Upload a new file to a knowledge folder
POST
Upload a file to a knowledge folder
Documentation Index
Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
Use this file to discover all available pages before exploring further.
Using our API via a dedicated deployment? Just replace
api.langdock.com with your deployment’s base URL: <deployment-url>/api/publicRequires an API key with the
KNOWLEDGE_FOLDER_API scope. The knowledge folder must be shared with the API key. See Share Knowledge Folders with the API for setup instructions.Request Format
This endpoint acceptsmultipart/form-data requests with the file attached.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
folderId | string | Yes | The ID of the knowledge folder |
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | The file to upload (max 256MB) |
url | string | No | Optional source URL to associate with the file |
Supported File Types
Knowledge folders support the following document types:- PDF (
.pdf) - Word documents (
.doc,.docx) - Text files (
.txt) - Markdown (
.md) - HTML (
.html) - PowerPoint (
.pptx,.ppt)
Examples
Upload a File with cURL
Upload a File with JavaScript
Upload with Source URL
Response Format
Success Response (200 OK)
Example Response
Error Handling
Processing Status
After upload, the file is processed asynchronously. Use the Retrieve Files endpoint to check processing status. ThesyncStatus field indicates the current state:
UPLOADING- File is being uploadedUPLOADED- File is uploaded and queued for processingEXTRACTING- Text is being extracted from the fileEMBEDDING- Embeddings are being generatedSYNCED- File is ready for searchACTION_FAILED,EXTRACTION_FAILED,EMBEDDING_FAILED,TIMEOUT- Processing failed
Async Upload Variant
For large files or when you don’t need to wait for the upload response, you can use the async upload endpoint:multipart/form-data fields and returns 202 Accepted after the file is received. Processing continues in the background.
GET {statusUrl} to poll processing status. The response returns the current status in result.syncStatus.
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.