v1

latestOpenAPI 3.0.02026-07-26117076.0 KB
File Upload

Upload File from Base64

Upload files using Base64-encoded data or Data URL format. Supports both pure Base64 strings and Data URL format with MIME type prefix.

post/api/common/upload/base64

Request body

base64_datastring required

Base64-encoded file data.

Supports two formats:

  1. Data URL format: data:image/png;base64,iVBORw0KGgo...

  2. Pure Base64 string: iVBORw0KGgo... (without MIME type prefix)

Supported formats: JPEG, PNG, GIF, WebP

Note: The Base64 string should not include any whitespace or newline characters.

upload_pathstring

Custom storage directory path.

If not specified, the system will auto-categorize the file.

Note: All files are stored with a temp/ prefix regardless of the specified path.

file_namestring

Custom filename for the uploaded file.

If not specified, the system will generate a unique filename in the format: {timestamp}_{random}_{extension}

Example auto-generated name: 20251229130857_a8B9cD2e.png

Example request

{
  "base64_data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
  "upload_path": "profile-images",
  "file_name": "user-avatar.png"
}

Response

File uploaded successfully

successboolean required

Indicates whether the upload was successful

codeinteger required

HTTP status code

msgstring required

Response message

Example response

{
  "success": true,
  "code": 200,
  "msg": "File uploaded successfully",
  "data": {
    "file_id": "1bdfdbac6ebc2228d0b398d728bf4699",
    "file_name": "test-image.png",
    "original_name": "image-from-url.png",
    "file_size": 1419815,
    "mime_type": "image/png",
    "upload_path": "temp/test-uploads",
    "file_url": "https://storage.poyo.ai/temp/test-uploads/test-image.png",
    "download_url": "https://storage.poyo.ai/temp/test-uploads/test-image.png",
    "upload_time": "2025-12-29T13:08:57.673515",
    "expires_at": "2026-01-01T13:08:57.673515"
  }
}