Attachment Upload
Attachment Upload Integration
Description
This API integrates the previously scattered file upload process, combining the functionalities of obtaining Presigned URL, uploading files to cloud storage, and uploading to Attachment into a single endpoint.
Endpoint Information
URL:
https://api.maiagent.ai/api/v1/attachments-upload/Method:
POSTContent Type:
multipart/form-data
Request Parameters
file
string(binary)
Yes
File to upload
Request Headers
Accept: application/json Authorization: Api-Key {Your API Key}
Request Example
Using curl to send request:
curl -X 'POST' \
"https://api.maiagent.ai/api/v1/attachments-upload/" \
-H 'accept: application/json' \
-H 'Authorization: YOU_API_KEY' \
-H 'Content-Type: multipart/form-data' \
-H 'X-CSRFTOKEN: B85SZ7NcBcOKGl4xXU9cSfFhoLG7larxgCy2RYoz0mKSvcQydAboukuKCCKjGKV' \
-F 'file=@32d91c61-79b3-40e1-b47d-e35d6d30861檔案.xls;type=application/vnd.ms-excel'Response
Successful Response (Status Code: 201)
{
"id": "c0f4b764-7cb8-4f1f-a1d4-80de93e6c3cc",
"type": "other",
"filename": "32d91c61-79b3-40e1-b47d-e35d6d30861檔案.xls",
"file": "https://api.maiagent.ai/media/chat/attachment/b82359c-cdd9-4cac-8ab1-c15be90e4d9b.xls"
}Response Field Description
id
string
Unique identifier of the file
type
string
File type, e.g., "other"
filename
string
Original filename
file
string
Access URL for the file
Usage Instructions
Prepare the file to be uploaded
Send POST request using multipart/form-data format
Request must include a valid API key
Upon successful upload, the system will return the file ID and access URL
Notes
Please ensure you have proper permissions to use this API
File size may be limited, please refer to your organization's purchased plan
Supported file types are as follows:
Documents: .doc, .docx, .txt, .pdf, .md
Spreadsheets: .xls, .xlsx, .csv
Presentations: .ppt, .pptx
Others: .json, .jsonlLast updated
Was this helpful?
