Skip to content

Upload Attachment ​

Upload attachment files to the system. Supports large file chunked uploads. Upload one chunk at a time, and the system automatically merges them into a complete file after all chunks are uploaded.

Interface Address:

text
/papi/file/uploadAttachment

Request Method:

text
POST

Content-Type:

text
multipart/form-data

Header Parameters:

ParameterTypeRequiredDescription
X-Access-KeystringYesAPI access key ID. See API Rules for authentication
X-SignaturestringYesSignature value, Base64-encoded HMAC-SHA256 hash
X-TimestampstringYesMillisecond Unix timestamp (13 digits)
X-NoncestringYesRandom string, 10-32 lowercase alphanumeric characters

Body Parameters:

ParameterTypeRequiredDescription
md5stringYesFile MD5 value
partNumberintegerYesChunk index
filefileYesChunk file stream
totalChunksintegerYesTotal number of chunks
fileSuffixstringYesFile suffix (including dot, e.g., .jpg)
fileNamestringYesFile name
totalSizeintegerYesTotal file size
targetPathstringNoDirectory
ctrIdsarray[string]NoCloud phone ctrIds

Note: This API uses multipart/form-data format.

Request Example:

text
md5: 24264aaf4064feb1f7e1fe8e6044aa3e
partNumber: 1
file: <binary>
totalChunks: 1
fileSuffix: .png
fileName: 3

Response Parameters:

ParameterTypeDescription
codeintegerError code. See Error Codes
dataobjectResponse data
├─ md5stringFile MD5
├─ partNumberintegerCurrent chunk number
├─ uploadedChunksarray[string]List of uploaded chunks
├─ totalChunksintegerTotal number of chunks
├─ urlstringFile URL, returned only when upload is complete
├─ appSidstring-
msgstringError message

Response Example:

json
{
    "code": 0,
    "data": {
        "md5": "",
        "partNumber": 0,
        "uploadedChunks": [""],
        "totalChunks": 0,
        "url": "",
        "appSid": ""
    },
    "msg": ""
}

OpenAPI Docs