Skip to main content

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.view or task-related permissions

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesmultipart/form-data

Path Parameters

ParameterTypeRequiredDescription
staffIdstringYesStaff member identifier
taskIdstringYesTask identifier

Request Body

Form data with a file field named file and metadata fields.

Form Fields

FieldTypeRequiredDescription
filefileYesFile to upload
uploadedByIdstringYesID of the user uploading the file
uploadedByTypestringYesType 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