Skip to main content
POST
Upload a file to a knowledge folder
Using our API via a dedicated deployment? Just replace api.langdock.com with your deployment’s base URL: <deployment-url>/api/public
The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.
Uploads a new file to a specified Knowledge base. The file will be processed, embedded, and made available for semantic search.
Requires an API key with the KNOWLEDGE_FOLDER_API scope. The API key itself needs the Editor role on the Knowledge base. See Share Knowledge bases with the API for setup instructions.

Request Format

This endpoint accepts multipart/form-data requests with the file attached.

Path Parameters

Form Fields

Supported File Types

Knowledge bases support the following document types:
  • PDF (.pdf)
  • Word documents (.doc, .docx)
  • Text files (.txt)
  • Markdown (.md)
  • HTML (.html)
  • PowerPoint (.pptx, .ppt)
Executable files and other potentially dangerous file types are blocked for security reasons.

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. The syncStatus field indicates the current state:
  • UPLOADING - File is being uploaded
  • UPLOADED - File is uploaded and queued for processing
  • EXTRACTING - Text is being extracted from the file
  • EMBEDDING - Embeddings are being generated
  • SYNCED - File is ready for search
  • ACTION_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:
This endpoint accepts the same multipart/form-data fields and returns 202 Accepted after the file is received. Processing continues in the background.
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.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Path Parameters

folderId
string
required

The ID of the knowledge folder

Body

multipart/form-data
file
file

The file to upload

url
string

The associated URL

Response

200

File uploaded successfully