Skip to main content
POST
/
api
/
upload
/
file
Upload file via multipart/form-data
curl --request POST \
  --url https://files-api.sinancode.com/api/upload/file \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file'
{
  "url": "https://upload-tmp.sinancode.com/uploads/user123/abc123def456.png",
  "cn_url": "https://beijing-user-upload-tmp.tos-cn-beijing.volces.com/uploads/user123/abc123def456.png",
  "key": "uploads/user123/abc123def456.png",
  "md5": "d41d8cd98f00b204e9800998ecf8427e",
  "size": 12345,
  "content_type": "image/png",
  "expires_at": "2024-01-17T00:00:00.000Z"
}
Upload files to cloud storage using standard multipart/form-data encoding. Key Features:
  • Standard Format - Uses multipart/form-data encoding, compatible with all HTTP clients
  • Large File Support - Supports files up to 50MB
  • Auto Detection - Automatically detects file MIME type
  • Dual Access - Returns both global and China access URLs

Authorizations

Authorization
string
header
required

Authorization token obtained from api.sinancode.com

Body

multipart/form-data
file
file
required

The file to upload (max 50MB)

Response

File uploaded successfully

url
string<uri>
required

Public URL to access the uploaded file (global)

Example:

"https://upload-tmp.sinancode.com/uploads/user123/abc123def456.png"

cn_url
string<uri>
required

Public URL to access the uploaded file (China)

Example:

"https://beijing-user-upload-tmp.tos-cn-beijing.volces.com/uploads/user123/abc123def456.png"

key
string
required

Storage key of the uploaded file

Example:

"uploads/user123/abc123def456.png"

md5
string
required

Hash of the file content (SHA-256 truncated)

Example:

"d41d8cd98f00b204e9800998ecf8427e"

size
integer
required

File size in bytes

Example:

12345

content_type
string
required

MIME type of the file

Example:

"image/png"

expires_at
string<date-time>
required

Expiration time of the file (ISO 8601)

Example:

"2024-01-17T00:00:00.000Z"