Upload file API

Upload File API

API Information

ItemDescription
MethodPOST
Path/apis/v1/files/upload
Content-Typemultipart/form-data
AuthenticationRequired. Refer to 'Authorization Introduction'

Description

This API uploads a file to object storage (S3) on behalf of an authenticated merchant user. The server returns a short-lived fileId.

Request Parameters

Headers

ParameterRequiredTypeDescription
PexxApiKeyYesstringMerchant API key.
PexxAuthorizationYesstringBearer + access token.

Form body (multipart/form-data)

ParameterRequiredTypeDescription
fileYesfileFile to upload. Must be non-empty. Maximum size 10MB.

Extension handling: if the original filename has a safe extension ([a-z0-9], max 10 characters), the stored object name is {fileId}.{ext}; otherwise {fileId} only.

Response

The response wrapper is ApiResponse<FileUploadResponse>.

Top-level fields

FieldTypeDescription
successbooleantrue when the upload succeeded.
messagestringOptional message.
dataobjectPresent when success is true. See below.
errorstringPresent when success is false.

data fields

FieldTypeDescription
fileIdstringThe uploaded file ID. Valid for 15 minutes.
expireTimeUTCstringISO-8601 timestamp (UTC) when the fileId expires.