Update a file in a knowledge folder
Knowledge Folder API
Update Attachment in Knowledge Folder
Replace an existing file in a knowledge folder with a new version
PATCH
Update a file in 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 |
|---|---|---|---|
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