跳转到主要内容
POST
/
api
/
v1
/
files
/
upload
/
base64
Base64文件上传
curl --request POST \
  --url https://files-api.evolink.ai/api/v1/files/upload/base64 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "base64_data": "data:image/png;base64,iVBORw0KGgo..."
}'
{
  "success": true,
  "code": 200,
  "msg": "文件上传成功",
  "data": {
    "file_id": "file_abc123",
    "file_name": "avatar.png",
    "original_name": "avatar.png",
    "file_size": 2048,
    "mime_type": "image/png",
    "upload_path": "avatars",
    "file_url": "https://files.evolink.ai/avatars/avatar.png",
    "download_url": "https://files.evolink.ai/api/v1/files/download/file_abc123",
    "upload_time": "2025-10-09T00:00:00+08:00",
    "expires_at": "2025-10-12T00:00:00+08:00"
  }
}

Authorizations

Authorization
string
header
required

##所有接口均需要使用Bearer Token进行认证##

获取 API Key :

访问 API Key 管理页面 获取您的 API Key

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

Body

application/json
base64_data
string
required

Base64编码的文件数据

支持格式:

  • Data URL格式:data:image/png;base64,iVBORw0KGgo...
  • 纯Base64编码:iVBORw0KGgo...

说明:

  • 单次请求最多支持1张图像
  • 当前仅支持:image/jpegimage/pngimage/gifimage/webp四种类型文件的上传
Example:

"data:image/png;base64,iVBORw0KGgo..."

upload_path
string

自定义上传路径

说明:

  • 不指定时系统会根据文件类型自动分类
Example:

"avatars"

file_name
string

自定义文件名

说明:

  • 不指定时系统会自动生成唯一文件名
Example:

"avatar.png"

Response

200 - application/json

文件上传成功

success
boolean

请求是否成功

Example:

true

code
integer

响应状态码

Example:

200

msg
string

响应消息

Example:

"文件上传成功"

data
object