Upload an attachment
Agents API
Upload Attachment API
Upload files to be used with Agents
POST
Upload an attachment
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/publicThis is the new Agents API with native Vercel AI SDK compatibility. The upload attachment endpoint is shared across both APIs. If you’re using the legacy Assistants API, see the migration guide.
Requires an API key with the
KNOWLEDGE_FOLDER_API scope. You can create API Keys in your Workspace
settings.Request Format
This endpoint acceptsmultipart/form-data requests with a single file upload.
| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The file you want to upload |
Response Format
The API returns the uploaded file information:Example
Error Handling
- Per-message (recommended): Include the attachment UUID in the message’s
metadata.attachmentsarray when calling the Completions API - Agent-level: Include the attachment UUID in the
attachmentsarray when creating or updating an agent
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.