Update a file in a knowledge folder
Knowledge Folder API
Update Attachment in Knowledge Folder
Replace an existing file in a Knowledge base with a new version
PATCH
Update a file in a knowledge folder
Using our API via a dedicated deployment? Just replace
api.langdock.com with your deployment’s base URL: <deployment-url>/api/publicThe Knowledge Folder API manages resources that appear as Knowledge bases in the Library.
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 acceptsmultipart/form-data requests with the file attached.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
folderId | string | Yes | The ID of the Knowledge base |
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
attachmentId | string | Yes | The ID of the attachment to update |
file | file | Yes | The new file to upload (max 256MB) |
url | string | No | URL shown to users when this file is used in an answer |
Examples
Update with cURL
Update with JavaScript
Update with Source URL
Response Format
Success Response (200 OK)
Example Response
Error Handling
Processing Status
After updating, the new 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
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
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Path Parameters
The ID of the knowledge folder
Body
multipart/form-data
Response
200
Attachment updated successfully