Add Task Attachment (v1)
Method + Path
POST /v1/workspace/staff/:staffId/tasks/:taskId/attachments
Actual backend path: /v1/workspace/staff/:staffId/tasks/:taskId/attachments
Description
Upload an attachment file for a task.
Authentication
Required - JWT token in Authorization header
Required Permissions:
staff.viewor task-related permissions
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | multipart/form-data |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
staffId | string | Yes | Staff member identifier |
taskId | string | Yes | Task identifier |
Request Body
Form data with a file field named file and metadata fields.
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | File to upload |
uploadedById | string | Yes | ID of the user uploading the file |
uploadedByType | string | Yes | Type of uploader. Valid values: staff, workspace |
Response (201)
{
"attachment": {
"id": "507f1f77bcf86cd799439014",
"fileName": "document.pdf",
"fileSizeBytes": 45678,
"mediaType": "application/pdf",
"url": "https://storage.example.com/attachments/document-123.pdf",
"uploadedById": "507f1f77bcf86cd799439012",
"uploadedByType": "staff",
"createdAt": "2024-01-15T11:00:00Z"
}
}
Common Errors
- 400 Bad Request: Missing file or invalid metadata
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Task or staff member not found
- 413 Payload Too Large: File size exceeds limit
- 415 Unsupported Media Type: Invalid file type
- 500 Internal Server Error: Server error