Skip to main content
POST
/
api
/
file-base64-upload
curl --request POST \ --url https://sunoapiorg.redpandaai.co/api/file-base64-upload \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "base64Data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==", "uploadPath": "images/base64", "fileName": "test-image.png" } '
{ "success": true, "code": 200, "msg": "File uploaded successfully", "data": { "fileName": "uploaded-image.png", "filePath": "images/user-uploads/uploaded-image.png", "downloadUrl": "https://tempfile.redpandaai.co/xxx/images/user-uploads/uploaded-image.png", "fileSize": 154832, "mimeType": "image/png", "uploadedAt": "2025-01-01T12:00:00.000Z" } }
Upload temporary files via Base64 encoded data. Note: Uploaded files are temporary and automatically deleted after 3 days.

Features

  • Supports Base64 encoded data and data URL format
  • Automatic MIME type recognition and file extension inference
  • Support for custom file names or auto-generation
  • Returns complete file information and download links
  • API Key authentication protection
  • Uploaded files are temporary and automatically deleted after 3 days

Supported Formats

  • Pure Base64 String: iVBORw0KGgoAAAANSUhEUgAA...
  • Data URL Format: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...

Usage Recommendations

  • Recommended for small files like images
  • For large files (>10MB), use the file stream upload API
  • Base64 encoding increases data transmission by approximately 33%

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
base64Data
string
required

Base64 encoded file data. Supports pure Base64 strings or data URL format

Example:

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

uploadPath
string
required

File upload path, without leading or trailing slashes

Example:

"images/base64"

fileName
string

File name (optional), including file extension. If not provided, a random filename will be generated. If the same filename already exists, the old file will be overwritten, but changes may not be immediately visible due to caching

Example:

"my-image.png"

Response

File uploaded successfully

success
boolean
required

Whether the request was successful

code
enum<integer>
required

Response status code

Available options:
200,
400,
401,
405,
500
msg
string
required

Response message

Example:

"File uploaded successfully"

data
object