Upload a file to a knowledge folder
Knowledge Folder API
Upload File to Knowledge Folder
Upload a new file to a Knowledge base
POST
Upload a file to a knowledge folder
Uploads a new file to a specified Knowledge base. The file will be processed, embedded, and made available for semantic search.
This endpoint accepts the same
File validation happens before the API accepts the upload. If validation fails, the async endpoint returns the same
Before You Start
- API key scope: Requires an API key with the
KNOWLEDGE_FOLDER_APIscope. The API key itself needs the Editor role on the Knowledge base. See Share Knowledge bases with the API for setup instructions. - Knowledge bases: The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.
Base URL
Request Format
This endpoint acceptsmultipart/form-data requests with the file attached.
Path Parameters
Form Fields
File size limits depend on the file type: 10 MB for plain text, Markdown, JSON, and VTT files; 30 MB for XML files; and 256 MB for other supported document types. See the supported file types reference for supported formats.
Supported File Types
Knowledge bases support document and text formats such as:- 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
File Validation Response (400 Bad Request)
If the file fails validation, the API returns the reason inmessage:
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.
400 Bad Request response shown above instead of 202 Accepted.
Use 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.