Attachments
Manage file attachments (images and other files) uploaded to documents. Files are stored in S3-compatible storage (MinIO/RustFS).
Base Path: /api/v1/attachments
Authentication: Required (Bearer Token)
Tag: Attachments
Upload Attachment
Upload a file to a document.
POST /attachments/upload
Request
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
file | MultipartFile | Yes | File to upload |
workspaceId | UUID | Yes | Workspace ID |
documentId | UUID | Yes | Document ID |
Example (cURL)
curl -X POST /api/v1/attachments/upload \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "workspaceId=660e8400-e29b-41d4-a716-446655440000" \
-F "documentId=550e8400-e29b-41d4-a716-446655440000"
Response
Status: 201 Created
{
"success": true,
"data": {
"id": "...",
"documentId": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "image.png",
"fileSize": 245760,
"mimeType": "image/png",
"url": "/api/v1/attachments/file?url=storage-key-123",
"width": 800,
"height": 600,
"createdAt": "2025-01-15T10:00:00Z"
}
}
Response Type: ApiResponse<AttachmentResponse>
Get File
Serve a file from storage. Used to display uploaded attachments.
GET /attachments/file?url={storageKey}
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | String | Yes | Storage key / URL of the file |
Response
Returns the file as a binary stream with the appropriate Content-Type header.
List Document Attachments
Retrieve all attachments for a specific document.
GET /attachments/document/{documentId}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
documentId | UUID | Document ID |
Response
{
"success": true,
"data": [
{
"id": "...",
"documentId": "...",
"fileName": "screenshot.png",
"fileSize": 245760,
"mimeType": "image/png",
"url": "/api/v1/attachments/file?url=...",
"width": 800,
"height": 600,
"createdAt": "2025-01-15T10:00:00Z"
}
]
}
Response Type: ApiResponse<List<AttachmentResponse>>
Delete Attachment
Delete an attachment and remove it from storage.
DELETE /attachments/{id}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | UUID | Attachment ID |
Response Type: ApiResponse<Void>