Upload Attachment API
Upload files that can be referenced in Assistant conversations using their attachment IDs.
To use the API you need an API key. You can create API Keys in your Workspace settings: https://app.langdock.com/settings/workspace/products/api
curl --request POST \
--url https://api.langdock.com/attachment/v1/upload \
--header 'Authorization: <authorization>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");
async function uploadAttachment() {
const form = new FormData();
form.append("file", fs.createReadStream("example.pdf"));
const response = await axios.post(
"https://api.langdock.com/attachment/v1/upload",
form,
{
headers: {
...form.getHeaders(),
Authorization: "Bearer YOUR_API_KEY",
},
}
);
console.log(response.data);
// {
// attachmentId: "550e8400-e29b-41d4-a716-446655440000",
// file: {
// name: "example.pdf",
// mimeType: "application/pdf",
// sizeInBytes: 1234567
// }
// }
}Request
This endpoint accepts multipart/form-data requests with a single file upload.
Method: POST
Path: /attachment/v1/upload
Content-Type: multipart/form-data
Header
Authorization (string, required) — API key as Bearer token. Format: "Bearer YOUR_API_KEY"
Body
file (file, required) — The file to upload
Response
200 application/json — Successfully uploaded file
Response JSON:
Field details:
Example usage
Use the returned attachmentId in the Assistant API by including it in the
attachmentIdsarray at the assistant level or message level.

