Skip to main content
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/public
The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.
Updates an existing file (attachment) in a Knowledge base by replacing it with a new version. The old file is removed and the new file is processed and embedded.
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

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. 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
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 new file to upload

url
string

URL that is shown to the user if the file is used in an answer

attachmentId
string

The ID of the attachment to update

Response

200

Attachment updated successfully