add Attachment
Developing
Testing Env
Testing Env
POST
/api/v1/attachments
Last modified:2025-05-05 21:36:13
API Documentation
Create Attachment [POST]
URL
/api/v1/attachments
Request Headers
Key | Value | Required |
---|---|---|
Accept | application/json | Yes |
user-token | {{user_token}} | Yes |
secure-business-key | {{secure_business_key}} | Yes |
Accept-Language | en/ar | No |
Content-Type | string | Should be multipart/form-data |
Request Parameters (Form Data)
Field | Type | Description | Required | Validation |
---|---|---|---|---|
name | string | Custom name for the attachment (defaults to original filename) | No | Max: 255 chars |
workspace_id | integer | ID of the workspace the attachment belongs to | Yes | Must exist in workspaces table |
assigned_to | integer | ID of user the attachment is assigned to | No | Min: 1 |
file | file | The file to upload | Yes | Max: 10MB, Mimes: jpg,jpeg,png,gif,mp4,mov,avi,pdf,doc,docx,txt |
Response
Success (201)
{
"status_code": 201,
"code": 1021,
"hint": "Resource created successfully",
"success": true,
"data": {
"attachment": {
"id": 3,
"name": "attachment1",
"path": "uploads/projects/attachments/PROJECT_ATTACHMENTS_8_259_1613968799.pdf",
"type": "document",
"size": 220.0478515625,
"workspace_id": "8",
"assigned_to": "850",
"business_id": 259,
"created_at": "2025-05-05T21:35:36.000000Z",
"updated_at": "2025-05-05T21:35:36.000000Z"
},
"message": "Attachment created successfully."
}
}
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/v1/attachments' \
--header 'Accept: application/json' \
--header 'Accept-Language: en' \
--header 'user-token: ' \
--header 'secure-business-key: 4765066450c0bd66325.48403130' \
--form 'name="attachment1"' \
--form 'workspace_id="8"' \
--form 'assign_to="850"' \
--form 'file=@""'
Response Response Example
{
"status_code": 201,
"code": 1021,
"hint": "Resource created successfully",
"success": true,
"data": {
"attachment": {
"id": 3,
"name": "attachment1",
"path": "uploads/projects/attachments/PROJECT_ATTACHMENTS_8_259_1613968799.pdf",
"type": "document",
"size": 220.0478515625,
"workspace_id": "8",
"assigned_to": "850",
"business_id": 259,
"created_at": "2025-05-05T21:35:36.000000Z",
"updated_at": "2025-05-05T21:35:36.000000Z"
},
"message": "Attachment created successfully."
}
}
Request
Header Params
Accept
stringÂ
optional
Example:
application/json
Accept-Language
stringÂ
optional
Example:
en
Content-Type
stringÂ
optional
Example:
application/json
user-token
stringÂ
optional
Example:
{{user_token}}
secure-business-key
stringÂ
optional
Example:
{{secure_business_key}}
Body Params multipart/form-data
name
string  | nullÂ
optional
Example:
attachment1
workspace_id
integerÂ
required
Example:
8
assign_to
integerÂ
optional
Example:
850
file
fileÂ
required